Socket
Book a DemoInstallSign in
Socket

pear-opwait

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pear-opwait

Pear operation stream promise wrapper

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
454
18.23%
Maintainers
1
Weekly downloads
 
Created
Source

pear-opwait

Pear operation stream promise wrapper

API

opwait(stream[, onstatus])

Waits for a stream that emits status objects { tag, data }. Resolves with the final payload, forwards errors while allowing observation of intermediate statuses.

Returns Promise<any> of the final data.

Arguments

  • stream: Readable emitting { tag, data }
  • onstatus: (status) => void|Promise<void> optional observer for each status

Behavior

  • Listens to data, end, error
  • tag === 'final' → stores data as resolution value
  • tag === 'error' → destroys stream with ERR_OPERATION_FAILED(message, data)
  • onstatus may be async; rejection throws into the stream via destroy(err)
  • Promise resolves on end with last seen final (or null if none)
  • Promise rejects on error from the stream (including wrapped operation errors)

License

Apache-2.0

FAQs

Package last updated on 14 Aug 2025

Did you know?

Socket

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