Skip to content

Commit 17cf09f

Browse files
committed
Version 1.0.0
1 parent 580401b commit 17cf09f

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,40 @@
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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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",

0 commit comments

Comments
 (0)