Skip to content

Function: parse()

ts
function parse(path): ParsedPath;

解析路径为对象。

Parameters

ParameterTypeDescription
pathstring要解析的路径

Returns

ParsedPath

包含路径各个部分的对象

Example

ts
parse('/home/user/dir/file.txt')
// 返回:
// {
//   root: '/',
//   dir: '/home/user/dir',
//   base: 'file.txt',
//   name: 'file',
//   ext: '.txt'
// }

Since

1.0.0

Released under the MIT License.