Reputation: 1895
I have an array that say for the example looks like that:
var position = [1,3,4,6];
I want to serialize the array to a file, let say position.txt.
Than I want to load the data saved to another running JS program, something like this:
var position = loadArrayFromFile("position.txt");
Is there something that I can use to do that?
Upvotes: 2
Views: 2969
Reputation: 1074595
JSON and file I/O is how I'd do it:
JSON.stringify
with writeFile
to write
readFile
with JSON.parse
to read
Upvotes: 5