用工小程序前端代码
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.

46 lines
1.6 KiB

6 months ago
  1. stream-wormhole
  2. =======
  3. [![NPM version][npm-image]][npm-url]
  4. [![build status][travis-image]][travis-url]
  5. [![Test coverage][codecov-image]][codecov-url]
  6. [![David deps][david-image]][david-url]
  7. [![Known Vulnerabilities][snyk-image]][snyk-url]
  8. [![npm download][download-image]][download-url]
  9. [npm-image]: https://img.shields.io/npm/v/stream-wormhole.svg?style=flat-square
  10. [npm-url]: https://npmjs.org/package/stream-wormhole
  11. [travis-image]: https://img.shields.io/travis/node-modules/stream-wormhole.svg?style=flat-square
  12. [travis-url]: https://travis-ci.org/node-modules/stream-wormhole
  13. [codecov-image]: https://codecov.io/github/node-modules/stream-wormhole/coverage.svg?branch=master
  14. [codecov-url]: https://codecov.io/github/node-modules/stream-wormhole?branch=master
  15. [david-image]: https://img.shields.io/david/node-modules/stream-wormhole.svg?style=flat-square
  16. [david-url]: https://david-dm.org/node-modules/stream-wormhole
  17. [download-image]: https://img.shields.io/npm/dm/stream-wormhole.svg?style=flat-square
  18. [download-url]: https://npmjs.org/package/stream-wormhole
  19. [snyk-image]: https://snyk.io/test/npm/stream-wormhole/badge.svg?style=flat-square
  20. [snyk-url]: https://snyk.io/test/npm/stream-wormhole
  21. Pipe ReadStream to a wormhole.
  22. ## Usage
  23. ```js
  24. const sendToWormhole = require('stream-wormhole');
  25. const fs = require('fs');
  26. const readStream = fs.createReadStream(__filename);
  27. // ignore all error by default
  28. sendToWormhole(readStream, true)
  29. .then(() => console.log('done'));
  30. // throw error
  31. sendToWormhole(readStream, true)
  32. .then(() => console.log('done'))
  33. .catch(err => console.error(err));
  34. ```
  35. ## License
  36. [MIT](LICENSE)