Module basic module

module path_win32

File path processing module

Reference method:

1
var path = require('path').win32;

static function

normalize

Standardize the path and process the parent directory and other information in the path

1
static String path_win32.normalize(String path);

Call parameters:

  • path: String, the given unprocessed path

Return results:

  • String, returns the processed path

basename

Query the file name in the path. If an extension is specified, the matching extension will be automatically canceled.

1 2
static String path_win32.basename(String path, String ext = "");

Call parameters:

  • path: String, the path of the given query
  • ext: String, specifies the extension. If there is a qualified extension in the file name, it will be automatically canceled.

Return results:

  • String, returns the file name

extname

Query the file extension in the path

1
static String path_win32.extname(String path);

Call parameters:

  • path: String, the path of the given query

Return results:

  • String, returns the obtained extension

format

Try formatting an object as a path

1
static String path_win32.format(Object pathObject);

Call parameters:

  • pathObject: Object, specify parameters

Return results:

  • String, returns the formatted path

The fields supported by pathObject are as follows:

1 2 3 4 5 6 7
{ "dir": "", // specify the directory of the path "root": "", // specify the root of the path "base": "", // specify the base of the path, it's the combination of name and ext "name": "", // specify the name of the path "ext": "", // specify the ext of the path }

parse

Parse paths into path objects

1
static NObject path_win32.parse(String path);

Call parameters:

  • path: String, path

Return results:

  • NObject, returns the pathObject object

dirname

Directory path in query path

1
static String path_win32.dirname(String path);

Call parameters:

  • path: String, the path of the given query

Return results:

  • String, returns the path to the obtained directory

fullpath

Convert the given path to a full path

1
static String path_win32.fullpath(String path);

Call parameters:

  • path: String, the path to the given conversion

Return results:

  • String, returns the full path of the conversion

isAbsolute

Identify whether the given path is an absolute path

1
static Boolean path_win32.isAbsolute(String path);

Call parameters:

  • path: String, given the path to be identified

Return results:

  • Boolean, returns true if it is an absolute path.

join

Merge a series of paths into a single path

1
static String path_win32.join(...ps);

Call parameters:

  • ps: ..., one or more related paths

Return results:

  • String, returns the new path obtained

resolve

Merge a series of paths into an absolute path

1
static String path_win32.resolve(...ps);

Call parameters:

  • ps: ..., one or more related paths

Return results:

  • String, returns the new path obtained

relative

Find the relative path from _from to to

1 2
static String path_win32.relative(String _from, String to);

Call parameters:

  • _from: String, source path
  • to: String, target path

Return results:

  • String, returns the relative path obtained

toNamespacedPath

Convert to namespace-prefixed path. Only valid in windows, other systems will return directly.

1
static Value path_win32.toNamespacedPath(Value path = undefined);

Call parameters:

  • path: Value, the given path.

Return results:

  • Value, returns the new path obtained

see: https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces

static properties

sep

String, query the path separation character of the current operating system, posix returns '/', windows returns '\'

1
static readonly String path_win32.sep;

delimiter

String, query the multi-path combination character of the current operating system, posix returns ':', windows returns ';'

1
static readonly String path_win32.delimiter;

posix

Object, posix implementation, seepath_posix

1
static readonly Object path_win32.posix;

win32

Object, windows implementation, see path_win32

1
static readonly Object path_win32.win32;