Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@chrismatheson
Created July 11, 2012 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismatheson/3089275 to your computer and use it in GitHub Desktop.
Save chrismatheson/3089275 to your computer and use it in GitHub Desktop.
Node script to convert simple note json output to standard text files
var fs = require('fs');
var notesString = fs.readFileSync('simplenote_export.json', 'utf8');
var notesArray = JSON.parse(notesString);
console.log('you have '+notesArray.length+' notes');
for (var i = notesArray.length - 1; i >= 0; i--) {
var filename = notesArray[i].content.substr(0,30)
filename = filename.replace(/(\r\n|\n|\r|\/|\\|<|>|:)/gm," ");
filename = filename.replace(/\s+/g," ");
//console.log(filename);
var newNote = fs.openSync('result/'+filename+'.txt','w');
fs.writeSync(newNote, notesArray[i].content);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment