Skip to content

Latest commit

 

History

History
58 lines (36 loc) · 1.05 KB

README.md

File metadata and controls

58 lines (36 loc) · 1.05 KB

ls-fs Build Status

File utils

Snuffles

Usage

var lsFs = require('ls-fs');

lsFs.readJson('settings.json').then(function(settings) {
    console.log(settings.prop1);
    console.log(settings.prop2);
});

API

readJson

lsFs.readJson(path, [opts]).then(function(parsedJsonObj) {
    console.log(parsedJsonObj);
});
Arguments
  1. path (String) The path to the JSON file to read

writeJson

lsFs.writeJson(path, obj, [opts]).then(function(pathToJson) {
    
});
Arguments
  1. path (String) The path to the JSON file to write
  2. obj (*) The thing to JSON.stringify

tmpDir

lsFs.tmpDir([opts]).then(function(pathToTmpDir) {
    // do stuff with my temporary directory
});
Arguments
  1. [opts] (Object) Same as https://github.com/raszi/node-tmp#directory-creation