Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bin-wrapper

Package Overview
Dependencies
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bin-wrapper - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

31

index.js

@@ -8,3 +8,2 @@ 'use strict';

var findFile = require('find-file');
var fs = require('fs');
var merge = require('mout/object/merge');

@@ -24,2 +23,4 @@ var path = require('path');

* - `dest` Where to download the binary
* - `version` Version of the binary
* - `global` Whether to check for global binaries or not
*

@@ -33,2 +34,3 @@ * @param {Object} opts

opts = opts || {};
this.opts = opts;
this.bin = opts.bin;

@@ -43,2 +45,3 @@

this.dest = opts.dest || process.cwd();
this.global = opts.global !== false;
this.paths = [this.dest];

@@ -78,2 +81,4 @@ this.path = this._find(this.bin) || path.join(this.dest, this.bin);

mode: '0755'
}).once('data', function () {
self.emit('download');
}).on('close', function () {

@@ -215,9 +220,11 @@ return self._test(path.join(self.dest, self.bin), cmd);

BinWrapper.prototype._find = function (bin) {
var file = findFile(bin, { path: this.paths, exclude: 'node_modules/.bin' });
var opts = { path: this.paths, exclude: 'node_modules/.bin' };
if (!this.global) {
opts.global = false;
}
var file = findFile(bin, opts);
if (file) {
if (fs.lstatSync(file[0]).isSymbolicLink()) {
return false;
}
if (executable.sync(file[0])) {

@@ -247,3 +254,13 @@ return file[0];

self.emit(works ? 'success' : 'fail');
if (self.opts.version && works) {
binCheck(bin, '--version', function (err, works, msg) {
if (msg) {
self.emit(msg.indexOf(self.opts.version) !== -1 ? 'success' : 'fail');
} else {
self.emit('success');
}
});
} else {
self.emit(works ? 'success' : 'fail');
}
});

@@ -250,0 +267,0 @@

{
"name": "bin-wrapper",
"version": "0.2.3",
"version": "0.2.4",
"description": "Binary wrapper that makes your programs seamlessly available as local dependencies",
"keywords": [
"bin",
"build",
"make",
"wrapper"
],
"homepage": "https://github.com/kevva/bin-wrapper",
"bugs": "https://github.com/kevva/bin-wrapper/issues",
"license": "MIT",
"repository": "kevva/bin-wrapper",
"author": {
"name": "Kevin Martensson",
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
"url": "http://kevinmartensson.com"
"url": "https://github.com/kevva"
},
"license": "MIT",
"repository": "git://github.com/kevva/bin-wrapper.git",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha --reporter list --timeout 0"
},
"main": "index.js",
"files": [
"index.js"
],
"keywords": [
"bin",
"build",
"make",
"wrapper"
],
"dependencies": {
"bin-check": "~0.1.0",
"download": "~0.1.2",
"executable": "~0.1.0",
"find-file": "~0.1.2",
"mout": "~0.9.0",
"progress": "~1.1.0",
"rimraf": "~2.2.6",
"tempfile": "~0.1.2"
"bin-check": "^0.1.0",
"download": "^0.1.2",
"executable": "^0.1.0",
"find-file": "^0.1.2",
"mout": "^0.9.1",
"rimraf": "^2.2.6",
"tempfile": "^0.1.2"
},
"devDependencies": {
"mocha": "~1.17.0"
},
"engines": {
"node": ">=0.10.0"
"mocha": "^1.18.2"
}
}

@@ -1,14 +0,16 @@

# bin-wrapper [![Build Status](https://secure.travis-ci.org/kevva/bin-wrapper.png?branch=master)](http://travis-ci.org/kevva/bin-wrapper)
# bin-wrapper [![Build Status](https://travis-ci.org/kevva/bin-wrapper.svg?branch=master)](https://travis-ci.org/kevva/bin-wrapper)
Binary wrapper for Node.js that makes your programs seamlessly available as local dependencies
> Binary wrapper for Node.js that makes your programs seamlessly available as local dependencies
## Getting started
## Install
Install with [npm](https://npmjs.org/package/bin-wrapper): `npm install bin-wrapper`
```bash
$ npm install --save bin-wrapper
```
## Examples
## Usage
```js
var BinWrapper = require('bin-wrapper');
var bin = new BinWrapper({ bin: 'gifsicle', dest: 'vendor' });
var bin = new BinWrapper({ bin: 'gifsicle', version: '1.71', dest: 'vendor' });

@@ -18,3 +20,2 @@ bin

.addUrl('https://raw.github.com/yeoman/node-gifsicle/0.1.4/vendor/linux/x64/gifsicle', 'linux', 'x64')
.addFile('https://raw.github.com/yeoman/node-jpegtran-bin/master/vendor/win/x64/libjpeg-62.dll', 'windows', 'x64')
.addSource('http://www.lcdf.org/gifsicle/gifsicle-1.71.tar.gz')

@@ -36,3 +37,3 @@ .check()

Get the path to your binary with `bin.path`.
Get the path to your binary with `bin.path`:

@@ -92,2 +93,16 @@ ```js

### version
Type: `String`
Default: `undefined`
Define a specific version.
### global
Type: `Boolean`
Default: `true`
Whether to check for a binary globally or not.
### dest

@@ -102,2 +117,2 @@

[MIT License](http://en.wikipedia.org/wiki/MIT_License) (c) [Kevin Mårtensson](http://kevinmartensson.com)
[MIT License](http://en.wikipedia.org/wiki/MIT_License) © [Kevin Mårtensson](http://kevinmartensson.com)
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc