File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 11# Fluture Node
2+
3+ Common Node API's wrapped to return [ Fluture] [ ] Futures.
4+
5+ ## API
6+
7+ #### <a name =" once " href =" https://github.com/fluture-js/fluture-node/blob/v1.0.0/index.mjs#L9 " >` once :: String -> EventEmitter -> Future Error a ` </a >
8+
9+ Resolve a Future with the first event emitted over
10+ the given event emitter under the given event name.
11+
12+ When the Future is cancelled, it removes any trace of
13+ itself from the event emitter.
14+
15+ ``` js
16+ > const emitter = new EventEmitter ();
17+ > setTimeout (() => emitter .emit (' answer' , 42 ), 100 );
18+ > once (' answer' ) (emitter);
19+ Future .of (42 );
20+ ```
21+
22+ #### <a name =" buffer " href =" https://github.com/fluture-js/fluture-node/blob/v1.0.0/index.mjs#L41 " >` buffer :: ReadableStream a -> Future Error (Array a) ` </a >
23+
24+ Buffer all data on a Stream into a Future of an Array.
25+
26+ When the Future is cancelled, it removes any trace of
27+ itself from the Stream.
28+
29+ ``` js
30+ > const stream = new Readable ({read : () => {}});
31+ > setTimeout (() => {
32+ . stream .push (' hello' );
33+ . stream .push (' world' );
34+ . stream .push (null );
35+ . }, 100 );
36+ > buffer (stream);
37+ Future .of ([Buffer .from (' hello' ), Buffer .from (' world' )]);
38+ ```
39+
40+ [ Fluture ] : https://github.com/fluture-js/Fluture
Original file line number Diff line number Diff line change 11{
22 "name" : " fluture-node" ,
3- "version" : " 0 .0.0" ,
3+ "version" : " 1 .0.0" ,
44 "description" : " Common Node API's wrapped to return Fluture Futures" ,
55 "main" : " index" ,
66 "module" : " index.mjs" ,
You can’t perform that action at this time.
0 commit comments