Module basic module

Module path_posix

File path processing module

Reference method:

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

Static function

normalize

Standardize the path, process information such as the parent directory in the path

1
static String path_posix.normalize(String path);

Call parameters:

  • path : String, the given unprocessed path

Return result:

  • String , returns the processed path

basename

Query the file name in the path, if the extension is specified, the matching extension will be automatically canceled

1 2
static String path_posix.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 cancelled automatically

Return result:

  • String , returns the file name

extname

Query the file extension in the path

1
static String path_posix.extname(String path);

Call parameters:

  • path : String, the path of the given query

Return result:

  • String , return the extension

format

Try to format an object as a path

1
static String path_posix.format(Object pathObject);

Call parameters:

  • pathObject : Object, object
  • pathObject.dir :
  • pathObject.root :
  • pathObject.base :
  • pathObject.name :
  • pathObject.ext :

Return result:

  • String , returns the formatted path

parse

Resolve path to path object

1
static NObject path_posix.parse(String path);

Call parameters:

  • path : String, path

Return result:

  • NObject , return pathObject object

dirname

Directory path in the query path

1
static String path_posix.dirname(String path);

Call parameters:

  • path : String, the path of the given query

Return result:

  • String , return the path of the directory

fullpath

Convert the given path to the full path

1
static String path_posix.fullpath(String path);

Call parameters:

  • path : String, the path of the given conversion

Return result:

  • String , returns the full path of the conversion

isAbsolute

Identify whether the given path is an absolute path

1
static Boolean path_posix.isAbsolute(String path);

Call parameters:

  • path : String, given the path to be recognized

Return result:

  • Boolean , return true if it is an absolute path

join

Combine a series of paths into a single path

1
static String path_posix.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

1
static String path_posix.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 2
static String path_posix.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.

1
static Value path_posix.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 division character of the current operating system, posix returns'/', windows returns'\'

1
static readonly String path_posix.sep;

delimiter

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

1
static readonly String path_posix.delimiter;

posix

Object, posix implementation, see path_posix

1
static readonly Object path_posix.posix;

win32

Object, windows implementation, see path_win32

1
static readonly Object path_posix.win32;