Skip to content

Function: format() ​

ts
function format(pathObject): string;

从路径对象返回路径字符串。

Parameters ​

ParameterTypeDescription
pathObjectPartial<ParsedPath>路径对象

Returns ​

string

格式化后的路径字符串

Example ​

ts
format({
  root: '/',
  dir: '/home/user',
  base: 'file.txt',
  name: 'file',
  ext: '.txt'
}) // => '/home/user/file.txt'

Since ​

1.0.0

Released under the MIT License.