Reputation: 2838
I am using the fs.writeFile method in the following way:
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. But I can not find it anywhere on my system. So where is message.txt
created?
I am using Meteor.js
Upvotes: 2
Views: 2420
Reputation: 2838
I found the file by using the command process.cwd()
in my console.
Since I am using Meteor.js, the file is saved on default to:
../.meteor/local/build/programs/server
Upvotes: 5