-1

I'm using JavaScript for a project.

  1. scan data from text file
  2. process it
  3. store back the processed data into text file

I have the data retrieval part working but I'm not able to store processed data through JavaScript.

I'm gathering the processed data into an array...

Is there any API available?

ѺȐeallү
  • 2,887
  • 3
  • 22
  • 34

1 Answers1

1

You could use node.js.

I have a sample array as follows...

var cars = ["Saab", "Volvo", "BMW", "GMC", "Ford", "Honda"];

And I write to text file as such...

var fs = require('fs');
var file = fs.createWriteStream('cars.txt');
file.on('error', function(err) { /* error handling */ });
cars.forEach(function(v) { file.write(v.join(', ') + '\n'); });
file.end();
ѺȐeallү
  • 2,887
  • 3
  • 22
  • 34