Skip to content

wahengchang/filehelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

filehelper

it is a npm package that provides fs function, with file existed check before file write.

NPM

Install

$ npm install --save filehelper

Usage

Writing a file:

  • replace the old one, while the file is existed
  • create new one, while the file is not existed
var filehelper = require("filehelper")

var str = ' I love Peter 3';

filehelper.write('./data.json', str)
    .then( res=> {console.log('file is created');})
    

Read a file:

var filehelper = require("filehelper")

filehelper.read('./data.json')
    .then( res=> {console.log(res)})
    

License

MIT © Waheng Chang