JSPM

  • Created
  • Published
  • Downloads 748316
  • Score
    100M100P100Q178639F
  • License MIT

Binary wrapper that makes your programs seamlessly available as local dependencies

Package Exports

  • bin-wrapper

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 (bin-wrapper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

bin-wrapper Build Status

Binary wrapper for Node.js that makes your programs seamlessly available as local dependencies

Install

$ npm install --save bin-wrapper

Usage

var BinWrapper = require('bin-wrapper');

var bin = new BinWrapper();
    .src('https://raw.github.com/yeoman/node-jpegtran-bin/0.2.4/vendor/win/x64/jpegtran.exe', 'win32', 'x64')
    .src('https://raw.github.com/yeoman/node-jpegtran-bin/0.2.4/vendor/win/x64/libjpeg-62.dll', 'win32', 'x64')
    .dest('vendor')
    .use('jpegtran.exe')
    .version('>=1.3.0');

bin.run(['--version'], function (err) {
    if (err) {
        throw err;
    }

    console.log('jpegtran is working');
});

Get the path to your binary with bin.path():

console.log(bin.path()); // => path/to/vendor/jpegtran.exe

API

new BinWrapper()

Creates a new BinWrapper instance.

.src(url, os, arch)

Accepts a URL pointing to a file to download.

.dest(dest)

Accepts a path which the files will be downloaded to.

.use(bin)

Define which file to use as the binary.

.path()

Get the full path to your binary.

.version(range)

Define a semver range to check the binary against.

.run(cmd, cb)

Runs the search for the binary. If no binary is found it will download the file using the URL provided in .src(). It will also check that the binary is working by running it using cmd and checking it's exit code.

License

MIT © Kevin Mårtensson