Module path_win32
File path processing module
Reference method:
1var path = require('path').win32;
Static function
normalize
Standardize the path, process information such as the parent directory in the path
1static String path_win32.normalize(String path);
Call parameters:
- path: String, the given unprocessed path
Return result:
- String, Return the processed path
basename
Query the file name in the path, if the extension is specified, the matching extension will be automatically canceled
1
2static String path_win32.basename(String path,
String ext = "");
Call parameters:
- path: String, the path of the given query
- ext: String, specify the extension, if there is a qualified extension in the file name, it will be automatically canceled
Return result:
- String, Return file name
extname
Query the file extension in the path
1static String path_win32.extname(String path);
Call parameters:
- path: String, the path of the given query
Return result:
- String, Return the obtained extension
format
Try to format an object as a path
1static String path_win32.format(Object pathObject);
Call parameters:
- pathObject: Object, specify the parameters
Return result:
- String, Return the formatted path
The fields supported by pathObject are as follows:
1
2
3
4
5
6
7{
"dir": "", // 指定路径的目录
"root": "", // 指定路径的根目录
"base": "", // 指定路径的文件名,等同于 ${name}.${ext}
"name": "", // 指定路径的主文件名
"ext": "", // 指定路径的扩展名
}
parse
Resolve path to path object
1static NObject path_win32.parse(String path);
Call parameters:
- path: String, path
Return result:
- NObject, Return pathObject object
dirname
Directory path in the query path
1static String path_win32.dirname(String path);
Call parameters:
- path: String, the path of the given query
Return result:
- String, Return the path of the obtained directory
fullpath
Convert the given path to the full path
1static String path_win32.fullpath(String path);
Call parameters:
- path: String, the path of the given conversion
Return result:
- String, Return the full path of the conversion
isAbsolute
Identify whether the given path is an absolute path
1static Boolean path_win32.isAbsolute(String path);
Call parameters:
- path: String, given the path that needs to be recognized
Return result:
- Boolean, Return true if it is an absolute path
join
Combine a series of paths into a single path
1static String path_win32.join(...ps);
Call parameters:
- ps: ..., one or more related paths
Return result:
- String, Return the new path
resolve
Combine a series of paths into an absolute path
1static String path_win32.resolve(...ps);
Call parameters:
- ps: ..., one or more related paths
Return result:
- String, Return the new path
relative
Find the relative path from _from to to
1
2static String path_win32.relative(String _from,
String to);
Call parameters:
- _from: String, source path
- to: String, target path
Return result:
- String, Return the relative path
toNamespacedPath
Converted to a namespace-prefixed path. Only valid in windows, other systems return directly.
1static Value path_win32.toNamespacedPath(Value path = undefined);
Call parameters:
- path: Value, the given path.
Return result:
- Value, Return the new path
see: https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces
Static properties
sep
String, query the path split character of the current operating system, posix returns'/', windows returns'\'
1static readonly String path_win32.sep;
delimiter
String, query the multi-path combination characters of the current operating system, posix returns':', windows returns';'
1static readonly String path_win32.delimiter;
posix
Object, posix implementation, see path_posix
1static readonly Object path_win32.posix;
win32
Object, windows implementation, see path_win32
1static readonly Object path_win32.win32;