NodeJS - Write to file

var fs = require('fs'); var path = __dirname + '/helloworld.txt'; fs.writeFile(path, 'Hello World!', function (err) { if (err) return console.log(err); console.log('Hello World > ' + path); });

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.