This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |