Coder Social home page Coder Social logo

timothyklim / bin-wrapper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kevva/bin-wrapper

0.0 2.0 0.0 135 KB

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

License: MIT License

JavaScript 100.00%

bin-wrapper's Introduction

bin-wrapper Build Status

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

Getting started

Install with npm: npm install bin-wrapper

Examples

All platform and arch specific options takes precedence over the base options. See test.js for a full fleshed example.

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

var opts = {
    name: 'Gifsicle',
    bin: 'gifsicle',
    path: 'vendor',
    url: 'http://url/to/gifsicle',
    src: 'http://www.lcdf.org/gifsicle/gifsicle-1.71.tar.gz',
    buildScript: './configure --bindir="vendor" && make install',
    platform: {
        win32: {
            bin: 'gifsicle.exe',
            url: [
                'http://url/to/gifsicle.exe'
                'http://url/to/gifsicle.dll'
            ]
        }
    }
}
var bin = new Bin(opts);

bin.check('--version', function (works) {
    if (!works) {
        console.log('Pre-build test failed, compiling from source');
        return bin.build();
    }

    console.log('Binary passed the test');
});

Get the path to your binary with bin.path.

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

API

.check(cmd, cb)

Check if a binary is present and working. If it isn't, download and test it by running the binary with cmd and see if it exits correctly.

.build(cb)

Download the source archive defined in the src property and build it using the build script defined in the buildScript property.

License

MIT License (c) Kevin Mårtensson

bin-wrapper's People

Contributors

kevva avatar timothyklim avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.