📜  Node.js process.report.directory 属性

📅  最后修改于: 2022-05-13 01:56:22.664000             🧑  作者: Mango

Node.js process.report.directory 属性

process.report.directory是 process 模块内的 Process 类的内置应用程序编程接口,用于获取或设置编写报告的目录。

句法:

const process.report.directory

参数:此 api 不接受任何参数作为参数。

返回值:此api返回报告写入的目录。

示例 1:

index.js
// Node.js program to demonstrate the  
// Process.report.directory Property
  
// Importing process module
const process = require('process');
  
// Assigning the directory
process.report.directory = "GFG"
  
// Display the result
console.log(process.report.directory)


Javascript
// Node.js program to demonstrate the  
// Process.report.directory Property
  
// Importing process module
const process = require('process');
  
const directory = process.report.directory;
  
// Display the result
if (directory.length == 0)
    console.log("No directory is assigned")
else
    console.log(directory)


使用以下命令运行index.js文件:

node index.js

输出:

GFG

示例 2:

文件名:index.js

Javascript

// Node.js program to demonstrate the  
// Process.report.directory Property
  
// Importing process module
const process = require('process');
  
const directory = process.report.directory;
  
// Display the result
if (directory.length == 0)
    console.log("No directory is assigned")
else
    console.log(directory)

使用以下命令运行index.js文件:

node index.js

输出:

No file name is assigned

参考: https://nodejs.org/dist/latest-v16.x/docs/api/process.html#process_process_report_directory