@silver-zepp/vis-log
Version:
An on-screen logger for ZeppOS Mini apps.
1 lines • 520 B
JavaScript
import{readFileSync,writeFileSync}from"@zos/fs";export function readJSON(path,encoding="utf8"){try{const content=readFileSync({path:path,options:{encoding:encoding}});if(content===undefined||content===null){return null}return JSON.parse(content)}catch(e){console.log("readJSON()",e);return null}}export function writeJSON(path,data,encoding="utf8"){try{const content=JSON.stringify(data);writeFileSync({path:path,data:content,options:{encoding:encoding}});return true}catch(e){console.log("writeJSON()",e);return false}}