mercredi 29 avril 2015

Reading a file in Javascript in Node

I'm simply trying to read a text file in Node. I'm not in the DOM.

I can write to a file with this package but I'm having trouble reading from it .

I know i neead the following:

var fs = require('fs');

var readStream = fs.createReadStream('my_file.txt');

But the readStream is a complex object. I just want the variable as a string. Any ideas?

Aucun commentaire:

Enregistrer un commentaire