const fs = require('fs')
const content = 'Some content!'
try {
fs.writeFileSync('/Users/joe/test.txt', content)
//file written successfully
} catch (err) {
console.error(err)
}
const fs = require('fs');
fs.writeFile("/tmp/test", "Hey there!", function(err) {
if(err) {
return console.log(err);
}
console.log("The file was saved!");
});
// Or
fs.writeFileSync('/tmp/test-sync', 'Hey there!');
// append_file.js
const fs = require('fs');
// add a line to a lyric file, using appendFile
fs.appendFile('empirestate.txt', '
Right there up on Broadway', (err) => {
if (err) throw err;
console.log('The lyrics were updated!');
});
fs.writeFile('2pac.txt', 'Some other lyric', 'ascii', callback);
var fs = require('fs');
var txt = '
' + tkn_psid_id + ':' + assetUrl;
var folderName = '/duplicates/bugging/videobug/' + tkn_psid_id + '.txt';
fs.appendFile(folderName, txt, function (err) {
if (err) {
console.log('Append Error');
} else {
console.log('DuplicateFolder' + folder);
}
});