path
Path
Stability: 2 - Stable
The path
module provides utilities for working with file and directory paths. It can be accessed using:
const path = require('path');
Windows vs. POSIX
The default operation of the path
module varies based on the operating system on which a Node.js application is running. Specifically, when running on a Windows operating system, the path
module will assume that Windows-style paths are being used.
For example, using the path.basename()
function with the Windows file path C:\temp\myfile.html
, will yield different results when running on POSIX than when run on Windows:
On POSIX:
登录查看完整内容