https://github.com/stream-utils/pause
Pause a stream's data events
https://github.com/stream-utils/pause
javascript nodejs pause stream
Last synced: 6 months ago
JSON representation
Pause a stream's data events
- Host: GitHub
- URL: https://github.com/stream-utils/pause
- Owner: stream-utils
- License: mit
- Created: 2012-07-26T16:27:43.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2018-09-14T00:31:28.000Z (over 7 years ago)
- Last Synced: 2025-06-10T04:08:42.598Z (7 months ago)
- Topics: javascript, nodejs, pause, stream
- Language: JavaScript
- Homepage:
- Size: 25.4 KB
- Stars: 27
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE
Awesome Lists containing this project
README
# pause
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Node.js Version][node-image]][node-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]
Pause a stream's data events
## Installation
```sh
$ npm install pause
```
## API
```js
var pause = require('pause')
```
### handle = pause(stream)
Pause the data events on a stream and return a handle to resume or end the
stream.
#### handle.end()
Dispose of the handle. This does not end the stream, but it simply discards
the event collection, making `handle.resume()` a no-op.
#### handle.resume()
Resume the stream by re-emitting all the `data` events in the same order,
followed by an `end` event, if that was emitting during the pause.
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/pause.svg
[npm-url]: https://npmjs.org/package/pause
[node-image]: https://img.shields.io/node/v/pause.svg
[node-url]: https://nodejs.org/en/download/
[travis-image]: https://img.shields.io/travis/stream-utils/pause/master.svg
[travis-url]: https://travis-ci.org/stream-utils/pause
[coveralls-image]: https://img.shields.io/coveralls/stream-utils/pause.svg
[coveralls-url]: https://coveralls.io/r/stream-utils/pause?branch=master
[downloads-image]: https://img.shields.io/npm/dm/pause.svg
[downloads-url]: https://npmjs.org/package/pause