-1

I'm beginner to the JS development.what I want to do is write the data to a file in local storage.

In my application i read a raw data and save it in mongoDB as key value pairs.same time i want to write those data to a file in a local storage.

this code is used to read the read the file line by line.i get structured data in "event" .what i want to do is write those data to a file in local storage.

 var lines = readDetails.split('\n');

 for(var line = 0; line < lines.length-1; line++){
   var FileContent = "";
  
   var linesSpace = lines[line].split(' ');

   for(var y=3;y <= linesSpace.length-1;y++){
   
      FileContent +=linesSpace[y];
      FileContent += " ";
      
      }
      
     var event = {
          dat: linesSpace[0],
          tim: linesSpace[1],
          details: FileContent,
  
  }; 
 
}

if this is not that much clear .please questioned me.

Thanks.

4
  • By local storage do you mean the HTML 5 local storage API or do you want to save it on some file on local disk ? Commented May 26, 2017 at 8:52
  • you can use localStorage.setItem("data",JSON.stringify(YOUR DATA)); Commented May 26, 2017 at 8:55
  • @Harry i meant a file on local disk. Commented May 26, 2017 at 8:56
  • I guess this is what you are looking for. Commented May 26, 2017 at 8:58

1 Answer 1

0

ngStorage is the best I've found, super easy to use.

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.