Node.js - process.report.directory Property


The process.report.directory property is used to get or set the directory where the report is written. The default value is the empty string that indicates the reports are written to the current working directory of the Node.js Process.

Syntax

process.report.directory

Example 1

Create a file with the name "directory.js" and copy the following code snippet. After creating the file, use the command "node directory.js" to run this code as shown in the example below −

// process.report.directory Property Demo Example

// Importing the process module
const process = require('process');

// Assigning a directory to store
process.report.directory = "/tutorialsPoint"

// Printing the result
console.log(process.report.directory)

Output

C:\home
ode>> node directory.js /tutorialsPoint

Example 2

Let's take a look at one more example −

// process.report.directory Property Demo Example

// Importing the process module
const process = require('process');

const directory = process.report.directory;

// Printing the result
if (directory.length == 0)
   console.log("No directory is assigned")
else
   console.log(directory)

Output

C:\home
ode>> node directory.js No directory is assigned

Updated on: 17-Jan-2022

88 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements