Node.js – process.report.filename Property


The process.report.filename property is used to get or set the filename where the report will be written. If this value is set as an empty string, the output filename will be made as per the timestamp, PID and sequence number. Its default value is an empty string.

Syntax

process.report.filename

Example 1

Create a file with the name "filename.js" and copy the following code snippet. After creating the file, use the command "node filename.js" to run this code.

// process.report.directory Property Demo Example

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

// Passing the filename
process.report.filename = "tutorialspoint"

// Printing the result
console.log(`Report filename is ${process.report.filename}`)

Output

Report filename is 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');

// Passing the filename
const filename = process.report.filename;

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

Output

No file name is assigned

Updated on: 29-Oct-2021

56 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements