Skip to content

Commit 502ced2

Browse files
committed
Tweaks
1 parent 0b871e0 commit 502ced2

2 files changed

Lines changed: 21 additions & 26 deletions

File tree

index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
'use strict';
22

33
var fs = require('fs');
4-
var lazyReq = require('lazy-req')(require);
54
var path = require('path');
6-
5+
var lazyReq = require('lazy-req')(require);
76
var binCheck = lazyReq('bin-check');
87
var binVersionCheck = lazyReq('bin-version-check');
98
var Download = lazyReq('download');
@@ -25,6 +24,8 @@ function BinWrapper(opts) {
2524
this.opts.strip = this.opts.strip <= 0 ? 0 : !this.opts.strip ? 1 : this.opts.strip;
2625
}
2726

27+
module.exports = BinWrapper;
28+
2829
/**
2930
* Get or set files to download
3031
*
@@ -215,9 +216,3 @@ BinWrapper.prototype.download = function (cb) {
215216
.dest(this.dest())
216217
.run(cb);
217218
};
218-
219-
/**
220-
* Module exports
221-
*/
222-
223-
module.exports = BinWrapper;

readme.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
> Binary wrapper that makes your programs seamlessly available as local dependencies
44
5+
56
## Install
67

7-
```sh
8+
```
89
$ npm install --save bin-wrapper
910
```
1011

12+
1113
## Usage
1214

1315
```js
@@ -23,10 +25,6 @@ var bin = new BinWrapper()
2325
.version('>=1.71');
2426

2527
bin.run(['--version'], function (err) {
26-
if (err) {
27-
throw err;
28-
}
29-
3028
console.log('gifsicle is working');
3129
});
3230
```
@@ -37,22 +35,23 @@ Get the path to your binary with `bin.path()`:
3735
console.log(bin.path()); // => path/to/vendor/gifsicle
3836
```
3937

38+
4039
## API
4140

42-
### new BinWrapper(opts)
41+
### new BinWrapper(options)
4342

4443
Creates a new `BinWrapper` instance.
4544

46-
#### opts.skipCheck
45+
#### options.skipCheck
4746

48-
Type: `Boolean`
47+
Type: `boolean`
4948
Default: `false`
5049

5150
Whether to skip the binary check or not.
5251

53-
#### opts.strip
52+
#### options.strip
5453

55-
Type: `Number`
54+
Type: `number`
5655
Default: `1`
5756

5857
Strip a number of leading paths from file names on extraction.
@@ -63,35 +62,35 @@ Adds a source to download.
6362

6463
#### url
6564

66-
Type: `String`
65+
Type: `string`
6766

6867
Accepts a URL pointing to a file to download.
6968

7069
#### os
7170

72-
Type: `String`
71+
Type: `string`
7372

7473
Tie the source to a specific OS.
7574

7675
#### arch
7776

78-
Type: `String`
77+
Type: `string`
7978

8079
Tie the source to a specific arch.
8180

8281
### .dest(dest)
8382

8483
#### dest
8584

86-
Type: `String`
85+
Type: `string`
8786

8887
Accepts a path which the files will be downloaded to.
8988

9089
### .use(bin)
9190

9291
#### bin
9392

94-
Type: `String`
93+
Type: `string`
9594

9695
Define which file to use as the binary.
9796

@@ -103,7 +102,7 @@ Returns the full path to your binary.
103102

104103
#### range
105104

106-
Type: `String`
105+
Type: `string`
107106

108107
Define a [semver range](https://github.com/isaacs/node-semver#ranges) to check
109108
the binary against.
@@ -115,18 +114,19 @@ using the URL provided in `.src()`.
115114

116115
#### cmd
117116

118-
Type: `Array`
117+
Type: `array`
119118
Default: `['--version']`
120119

121120
Command to run the binary with. If it exits with code `0` it means that the
122121
binary is working.
123122

124123
#### cb(err)
125124

126-
Type: `Function`
125+
Type: `function`
127126

128127
Returns nothing but a possible error.
129128

129+
130130
## License
131131

132132
MIT © [Kevin Mårtensson](http://kevinmartensson.com)

0 commit comments

Comments
 (0)