@write-for-christ/pic-piper
v0.1.0
Published
A useful node library to pipe the pics and convert them continously in reactive way.
Downloads
5
Maintainers
Readme
@write-for-christ/pic-piper
A useful node library to pipe the pics and convert them continously in reactive way.
Features
- Run all or watch for pics changed in different pipe stream.
- Execute actions in the stack with configured priorities.
- Convert pics to another format with the help of images.
Installation
npm install @write-for-christ/pic-piper
How to use?
const picpiper = require('@write-for-christ/pic-piper');
const dirOut = path.join(__dirname, '/dist');
const dirOne = path.join(__dirname, '/origin/source1/');
const dirTwo = path.join(__dirname, '/origin/source2/');
const pipe1 = new picpiper.Pipe(dirOne, { recursive: true }, p => {
// Should resolve relative path and file name before convert
return p.rel;
});
const pipe2 = new picpiper.Pipe(dirTwo, { recursive: true }, p => {
// Should resolve relative path and file name before convert
return p.rel;
});
picpiper.pipe([pipe1, pipe2], dirOut, {
convertTo: [
{
ext: '.webp',
size: '210x118'
},
{
ext: '.jpg',
size: '210x118'
}
],
default: '/path/to/default/image/if/error.jpg'
});