Skip to content

A promise based async file work flow using gulp facade api

Notifications You must be signed in to change notification settings

slashhuang/fs-pipe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fs-pipe

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

    npm install fs-pipe

soure code

fs-pipe

usage case

    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 使用代码

About

A promise based async file work flow using gulp facade api

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published