process.cwd()
- 返回: <string>
process.cwd()
方法返回 Node.js 进程的当前工作目录。
import { cwd } from 'node:process';
console.log(`Current directory: ${cwd()}`);
const { cwd } = require('node:process');
console.log(`Current directory: ${cwd()}`);
- Returns: <string>
The process.cwd()
method returns the current working directory of the Node.js
process.
import { cwd } from 'node:process';
console.log(`Current directory: ${cwd()}`);
const { cwd } = require('node:process');
console.log(`Current directory: ${cwd()}`);