slue-fs

1.1.10 • Public • Published

slue-fs

Provide one or a array list of glob, to read and write files by stream.

read

const slueFs = require('slue-fs');
const transformObj = require('slue-stream').transformObj;
const patterns = ['./src/**/*.js'];
 
slueFs.read(patterns).pipe(transformObj(function(file, env, cb) {
    console.log(file);
    cb(null, file);
}));

write

const slueFs = require('slue-fs');
const transformObj = require('slue-stream').transformObj;
slueFs.read('./test/a.js').pipe(transformObj(function(obj, env, cb) {
    cb(null, obj);
})).pipe(slueFs.write('./test/park'));

watch

const slueFs = require('slue-fs');
let watcher = slueFs.watch(['./src/**/*.js']);
watcher.on('change', function(filePath, stat) {
    console.log(filePath);
});

/slue-fs/

    Package Sidebar

    Install

    npm i slue-fs

    Weekly Downloads

    3

    Version

    1.1.10

    License

    ISC

    Unpacked Size

    6.79 kB

    Total Files

    8

    Last publish

    Collaborators

    • songgenlei