https://github.com/wahengchang/filehelper
it is a npm package that provides fs function
https://github.com/wahengchang/filehelper
filesystem nodejs tool tutorial utils write
Last synced: 29 days ago
JSON representation
it is a npm package that provides fs function
- Host: GitHub
- URL: https://github.com/wahengchang/filehelper
- Owner: wahengchang
- Created: 2017-06-09T07:09:52.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-10T09:49:08.000Z (almost 9 years ago)
- Last Synced: 2025-07-09T11:39:42.626Z (11 months ago)
- Topics: filesystem, nodejs, tool, tutorial, utils, write
- Language: JavaScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# filehelper
it is a npm package that provides fs function, with file existed check before file write.
[](https://www.npmjs.com/package/filehelper)
## 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
```js
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:
```js
var filehelper = require("filehelper")
filehelper.read('./data.json')
.then( res=> {console.log(res)})
```
## License
MIT © [Waheng Chang](http://github.com/wahengchang)