Home > Web Front-end > JS Tutorial > Instructions for using the path.delimiter method in node.js_node.js

Instructions for using the path.delimiter method in node.js_node.js

WBOY
Release: 2016-05-16 16:28:09
Original
2077 people have browsed it

Method description:

The method will return the real path of the platform. Multiple paths are separated by ":" or ";".

Grammar:

Copy code The code is as follows:

path.delimiter

Since this method belongs to the path module, the path module needs to be introduced before use (var path= require(“path”) )

Receive parameters:

None

Example:

Copy code The code is as follows:

//Example on *nix systems:

console.log(process.env.PATH)
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'

process.env.PATH.split(path.delimiter)
// returns
['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']

Example on windows:

console.log(process.env.PATH)
// 'C:Windowssystem32;C:Windows;C:Program Filesnodejs'

process.env.PATH.split(path.delimiter)
// returns
['C:Windowssystem32', 'C:Windows', 'C:Program Filesnodejs']
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template