@write-for-christ/pic-piper

0.1.0 • Public • Published

@write-for-christ/pic-piper

A useful node library to pipe the pics and convert them continously in reactive way.

Build Status Coverage Status David David Commitizen friendly Greenkeeper badge Wallaby.js

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

Package Sidebar

Install

npm i @write-for-christ/pic-piper

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • nampdn