Node.js process.report.directory Property

Last Updated : 25 May, 2021

The process.report.directory is an inbuilt application programming interface of class Process within process module which is used to get or set the directory where the report is written.

Syntax:

const process.report.directory

Parameters: This api takes no argument as a parameter.

Return Value: This api returns the directory where the report is written.

 

Example 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)

Run the index.js file using the following command:

node index.js

Output:

GFG

Example 2: 

Filename: 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)

Run the index.js file using the following command:

node index.js

Output:

No file name is assigned

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

Comment

Explore