Galerie und tage
This commit is contained in:
80
node_modules/exec-buffer/readme.md
generated
vendored
80
node_modules/exec-buffer/readme.md
generated
vendored
@@ -2,80 +2,82 @@
|
||||
|
||||
> Run a Buffer through a child process
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```ba
|
||||
$ npm install --save exec-buffer
|
||||
```
|
||||
$ npm install exec-buffer
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
const execBuffer = require('exec-buffer');
|
||||
const gifsicle = require('gifsicle').path;
|
||||
var ExecBuffer = require('exec-buffer');
|
||||
var fs = require('fs');
|
||||
var gifsicle = require('gifsicle').path;
|
||||
|
||||
execBuffer({
|
||||
input: fs.readFileSync('test.gif'),
|
||||
bin: gifsicle,
|
||||
args: ['-o', execBuffer.output, execBuffer.input]
|
||||
}).then(data => {
|
||||
console.log(data);
|
||||
//=> <Buffer 47 49 46 38 37 61 ...>
|
||||
var execBuffer = new ExecBuffer();
|
||||
|
||||
execBuffer.use(gifsicle, ['-o', execBuffer.dest(), execBuffer.src()]);
|
||||
execBuffer.run(fs.readFileSync('test.gif'), function (err, data) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
console.log(data);
|
||||
//=> <Buffer 47 49 46 38 37 61 ...>
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### execBuffer(options)
|
||||
### new ExecBuffer()
|
||||
|
||||
#### options
|
||||
Creates a new `ExecBuffer` instance.
|
||||
|
||||
Type: `Object`
|
||||
### .use(bin, args)
|
||||
|
||||
##### input
|
||||
#### bin
|
||||
|
||||
Type: `Buffer`
|
||||
|
||||
The `Buffer` to be ran through the child process.
|
||||
|
||||
##### bin
|
||||
|
||||
Type: `string`
|
||||
Type: `String`
|
||||
|
||||
Path to the binary.
|
||||
|
||||
##### args
|
||||
#### args
|
||||
|
||||
Type: `Array`
|
||||
|
||||
Arguments to run the binary with.
|
||||
|
||||
#### inputPath
|
||||
### .src(path)
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `tempfile()`
|
||||
#### path
|
||||
|
||||
Where `input` will be written to. In most cases you don't need to set this.
|
||||
Type: `String`
|
||||
|
||||
#### outputPath
|
||||
Set or get the temporary source path.
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `tempfile()`
|
||||
### .dest(path)
|
||||
|
||||
Where output file will be written to. In most cases you don't need to set this.
|
||||
#### path
|
||||
|
||||
### execBuffer.input
|
||||
Type: `String`
|
||||
|
||||
Returns a temporary path to where the input file will be written.
|
||||
Set or get the temporary destination path.
|
||||
|
||||
### execBuffer.output
|
||||
### .run(buf, cb)
|
||||
|
||||
Returns a temporary path to where the output file will be written.
|
||||
#### buf
|
||||
|
||||
Type: `Buffer`
|
||||
|
||||
The `Buffer` to be ran through the child process.
|
||||
|
||||
#### cb(err, data, stderr)
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Returns a `Buffer` with the new `data` and any `stderr` output.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
Reference in New Issue
Block a user