caolan / caolan/highland

implement callback on write

Open
#358 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.4k
Forks
145
PR merge metrics
No merged PRs in 30d

Description

I believe the intention of highlands `Stream.write` is to conform with the node stream interface. However, it does not take a callback as its third argument, which is causing problems for me in other library code once it is passed a highland stream rather than a "normal" writable stream. In particular there is code like:

```
return new Promise( function(res, rej) {
stream.write(data, null, function (err) { if(!!err) { rej(err); } else { res() }} );
}
```

which breaks when passing a stream created via `_()` around.

Simple to implement by listening to the "drain" event internally if you are emitting that correctly. (Are you interested in a pull request?)

Contributor guide

Open the contributing guide

Research direction

Locate the highland Stream.write implementation used by streams created via _(), then inspect how it emits or handles the drain event. Verify the third callback is invoked with an error when appropriate and without one on success, using the Promise example in the issue as the completion criterion.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.