2

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?

1
  • 2
    try JSON.stringify on writing and JSON.parse or require on reading. Commented Jun 17, 2016 at 8:11

1 Answer 1

5

JSON and file I/O is how I'd do it:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.