slue-fs

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

Usage no npm install needed!

<script type="module">
  import slueFs from 'https://cdn.skypack.dev/slue-fs';
</script>

README

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);
});