Socket
Socket
Sign inDemoInstall

pause

Package Overview
Dependencies
0
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

pause

Pause a stream's data events


Version published
Maintainers
3
Weekly downloads
2,206,662
decreased by-7.04%

Weekly downloads

Package description

What is pause?

The 'pause' npm package is designed to temporarily halt the execution of code. It is commonly used in scenarios where a delay is required before proceeding with the next part of the code. This can be particularly useful in asynchronous programming, testing, or creating time-based functionality.

What are pause's main functionalities?

Pausing execution for a set duration

This feature allows the user to pause the execution of code for a specified duration. In the provided code sample, the execution is paused for 2000 milliseconds (2 seconds) before printing 'End after 2 seconds'.

const pause = require('pause');

async function run() {
  console.log('Start');
  await pause(2000); // Pause for 2000 milliseconds
  console.log('End after 2 seconds');
}

run();

Other packages similar to pause

Readme

Source

pause

NPM Version NPM Downloads Node.js Version Build Status Test Coverage

Pause a stream's data events

Installation

$ npm install pause

API

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

FAQs

Last updated on 02 Jul 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc