You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # exec-buffer [![Build Status](http://img.shields.io/travis/kevva/exec-buffer.svg?style=flat)](https://travis-ci.org/kevva/exec-buffer)
  2. > Run a Buffer through a child process
  3. ## Install
  4. ```
  5. $ npm install exec-buffer
  6. ```
  7. ## Usage
  8. ```js
  9. const fs = require('fs');
  10. const execBuffer = require('exec-buffer');
  11. const gifsicle = require('gifsicle').path;
  12. execBuffer({
  13. input: fs.readFileSync('test.gif'),
  14. bin: gifsicle,
  15. args: ['-o', execBuffer.output, execBuffer.input]
  16. }).then(data => {
  17. console.log(data);
  18. //=> <Buffer 47 49 46 38 37 61 ...>
  19. });
  20. ```
  21. ## API
  22. ### execBuffer(options)
  23. #### options
  24. Type: `Object`
  25. ##### input
  26. Type: `Buffer`
  27. The `Buffer` to be ran through the child process.
  28. ##### bin
  29. Type: `string`
  30. Path to the binary.
  31. ##### args
  32. Type: `Array`
  33. Arguments to run the binary with.
  34. #### inputPath
  35. Type: `string`<br>
  36. Default: `tempfile()`
  37. Where `input` will be written to. In most cases you don't need to set this.
  38. #### outputPath
  39. Type: `string`<br>
  40. Default: `tempfile()`
  41. Where output file will be written to. In most cases you don't need to set this.
  42. ### execBuffer.input
  43. Returns a temporary path to where the input file will be written.
  44. ### execBuffer.output
  45. Returns a temporary path to where the output file will be written.
  46. ## License
  47. MIT © [Kevin Mårtensson](https://github.com/kevva)