https://github.com/slashhuang/fs-pipe
A promise based async file work flow using gulp facade api
https://github.com/slashhuang/fs-pipe
filesystem io nodejs
Last synced: 4 months ago
JSON representation
A promise based async file work flow using gulp facade api
- Host: GitHub
- URL: https://github.com/slashhuang/fs-pipe
- Owner: slashhuang
- Created: 2017-02-20T11:15:39.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-24T11:44:08.000Z (almost 9 years ago)
- Last Synced: 2025-08-17T13:27:01.517Z (5 months ago)
- Topics: filesystem, io, nodejs
- Language: JavaScript
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fs-pipe

> a Promise based file stream work flow
> if you are familiar with gulp
> you will find fs-pipe very useful to you to handle file IO
## install
```bash
npm install fs-pipe
```
## soure code
[fs-pipe](./babel/index.js)
## usage case
```javascript
const path = require('path');
import FsPiper from 'fs-pipe';
const inst = new FsPiper();
let getFile = (...name)=> path.resolve.apply(null,[process.cwd(),...name])
let sourceStream = getFile(".babelrc");
let destStream1 = getFile("example","hello");
let destStream2 = getFile("example","hello1");
let emptyStream = getFile("test","readme.md");
let callback = ()=>console.log("stream done")
inst.src(sourceStream,callback)
.pipe(destStream1,callback) // write stream
.pipe(destStream2,callback) // write stream
.empty(emptyStream,callback) // empty file
.final(()=>console.log('file stream done')); // final callback
```
## changeLog
- v1.0.6
> Add callback for pipe/src/empty to detailize stream detection
> [使用代码](./test/v1.0.5-test.js)