JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 488255
  • Score
    100M100P100Q175206F
  • License MIT

Run a buffer through a child process

Package Exports

  • exec-buffer

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (exec-buffer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

exec-buffer Build Status

Run a Buffer through a child process

Install

$ npm install --save exec-buffer

Usage

var ExecBuffer = require('exec-buffer');
var fs = require('fs');
var gifsicle = require('gifsicle').path;

var execBuffer = new ExecBuffer();

execBuffer
    .use(gifsicle, ['-o', execBuffer.dest(), execBuffer.src()])
    .run(fs.readFileSync('test.gif'), function (err, data) {
        if (err) {
            throw err;
        }

        console.log(data);
        // <Buffer 47 49 46 38 37 61 ...>
    });
});

API

new ExecBuffer(opts)

Creates a new ExecBuffer instance. Available options are:

  • stderr: Whether to add stderr output to err in the callback. Defaults to true.

.use(bin, args)

bin

Type: String

Path to the binary.

args

Type: Array

Arguments to run the binary with.

.src(path)

Type: String

Set or get the temporary source path.

.dest(path)

Type: String

Set or get the temporary destination path.

.run(buf, cb)

buf

Type: Buffer

The Buffer to be ran through the child process.

cb(err, data)

Type: Function

Returns a Buffer with the new data.

License

MIT © Kevin Mårtensson