Skip to content

Instantly share code, notes, and snippets.

@Jazarro
Jazarro / nativescript-file-system-example
Last active October 19, 2016 12:07 — forked from mikebranstein/nativescript-file-system-example
NativeScript file-system module example
var fileSystemModule = require("file-system");
var fileName = "persistedFile.json";
var file = fileSystemModule.knownFolders.documents().getFile(fileName);
var data = [{"id": "1", "value": "NativeScript"}, ...];
// write data to the file, converted to a JSON string first
file.writeText(JSON.stringify(data));
// read data from the file