[英]Where does node file system (fs.writeFile) writes to on default in Meteor.js?
I am using the fs.writeFile method in the following way:我通过以下方式使用 fs.writeFile 方法:
fs = require('fs');
fs.writeFile('message.txt', 'Hello Node.js', (err) => {
console.log('It\'s saved!');
fs.readFile('message.txt', function (data) {
console.log("Asynchronous read: " + data.toString());
});
});
output:输出:
It's saved!
Asynchronous read: Hello Node.js
Since I receive the expected output, I assume that the file message.txt
is created somewhere, and I am actually writing and reading to/from it.因为我收到了预期的输出,所以我假设文件
message.txt
是在某处创建的,我实际上是在向它写入和读取它。 But I can not find it anywhere on my system.但是我在系统上的任何地方都找不到它。 So where is
message.txt
created?那么
message.txt
是在哪里创建的呢?
I am using Meteor.js我正在使用 Meteor.js
I found the file by using the command process.cwd()
in my console.我通过在控制台中使用命令
process.cwd()
找到了该文件。
Since I am using Meteor.js, the file is saved on default to:由于我使用的是 Meteor.js,文件默认保存为:
../.meteor/local/build/programs/server
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.