Pear operation stream promise wrapper
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 statusBehavior
data, end, errortag === 'final' → stores data as resolution valuetag === 'error' → destroys stream with ERR_OPERATION_FAILED(message, data)onstatus may be async; rejection throws into the stream via destroy(err)end with last seen final (or null if none)error from the stream (including wrapped operation errors)Apache-2.0