Node.js – process.report.filename 屬性
process.report.filename 屬性用於獲取或設定寫入報告的檔名。如果該值設為空字串,則輸出檔名將根據時間戳、PID 和序列號生成。其預設值為一個空字串。
語法
process.report.filename
範例 1
建立一個名為 "filename.js" 的檔案,並複製以下程式碼片段。建立該檔案後,使用命令 "node filename.js" 來執行此程式碼。
// 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}`)輸出
Report filename is tutorialspoint
範例 2
我們來看另一個範例。
// 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)輸出
No file name is assigned
廣告內容
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
安卓
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP