Socket
Socket
Sign inDemoInstall

exec-buffer

Package Overview
Dependencies
16
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    exec-buffer

Run a buffer through a child process


Version published
Weekly downloads
587K
increased by4.89%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 20 Oct 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc