-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
18 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ $ npm install fluture fluture-node | |
|
||
### EventEmitter | ||
|
||
#### <a name="once" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L29">`once :: String -> EventEmitter -> Future Error a`</a> | ||
#### <a name="once" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L29">`once :: String -> EventEmitter -> Future Error a`</a> | ||
|
||
Resolve a Future with the first event emitted over | ||
the given event emitter under the given event name. | ||
|
@@ -27,7 +27,7 @@ Future.of (42); | |
|
||
### Buffer | ||
|
||
#### <a name="encode" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L63">`encode :: Charset -> Buffer -> Future Error String`</a> | ||
#### <a name="encode" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L63">`encode :: Charset -> Buffer -> Future Error String`</a> | ||
|
||
Given an encoding and a [Buffer][], returns a Future of the result of | ||
encoding said buffer using the given encoding. The Future will reject | ||
|
@@ -40,7 +40,7 @@ with an Error if the encoding is unknown. | |
|
||
### Stream | ||
|
||
#### <a name="streamOf" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L80">`streamOf :: Buffer -> Future a (Readable Buffer)`</a> | ||
#### <a name="streamOf" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L80">`streamOf :: Buffer -> Future a (Readable Buffer)`</a> | ||
|
||
Given a [Buffer][], returns a Future of a [Readable][] stream which will | ||
emit the given Buffer before ending. | ||
|
@@ -49,12 +49,12 @@ The stream is wrapped in a Future because creation of a stream causes | |
side-effects if it's not consumed in time, making it safer to pass it | ||
around wrapped in a Future. | ||
|
||
#### <a name="emptyStream" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L96">`emptyStream :: Future a (Readable Buffer)`</a> | ||
#### <a name="emptyStream" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L96">`emptyStream :: Future a (Readable Buffer)`</a> | ||
|
||
A [Readable][] stream which ends after emiting zero bytes. Can be useful | ||
as an empty [`request`](#request) body, for example. | ||
|
||
#### <a name="buffer" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L102">`buffer :: Readable a -> Future Error (Array a)`</a> | ||
#### <a name="buffer" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L102">`buffer :: Readable a -> Future Error (Array a)`</a> | ||
|
||
Buffer all data on a [Readable][] stream into a Future of an Array. | ||
|
||
|
@@ -72,7 +72,7 @@ itself from the Stream. | |
Future.of ([Buffer.from ('hello'), Buffer.from ('world')]); | ||
``` | ||
|
||
#### <a name="bufferString" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L141">`bufferString :: Charset -> Readable Buffer -> Future Error String`</a> | ||
#### <a name="bufferString" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L141">`bufferString :: Charset -> Readable Buffer -> Future Error String`</a> | ||
|
||
A version of [`buffer`](#buffer) specialized in Strings. | ||
|
||
|
@@ -81,7 +81,7 @@ a Future containing a String with the fully buffered and encoded result. | |
|
||
### Event Loop | ||
|
||
#### <a name="instant" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L153">`instant :: b -> Future a b`</a> | ||
#### <a name="instant" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L153">`instant :: b -> Future a b`</a> | ||
|
||
Resolves a Future with the given value in the next tick, | ||
using [`process.nextTick`][]. The scheduled job cannot be | ||
|
@@ -93,7 +93,7 @@ blocking the event loop until it's completed. | |
Future.of ('noodles') | ||
``` | ||
|
||
#### <a name="immediate" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L169">`immediate :: b -> Future a b`</a> | ||
#### <a name="immediate" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L169">`immediate :: b -> Future a b`</a> | ||
|
||
Resolves a Future with the given value in the next tick, | ||
using [`setImmediate`][]. This job will run as soon as all | ||
|
@@ -151,7 +151,7 @@ This contrasts with many of the popular HTTP client libraries out there, | |
which often make decisions for you, taking away control in an attempt to | ||
provide a smoother usage experience. | ||
|
||
#### <a name="request" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L255">`request :: Object -> Url -> Readable Buffer -> Future Error IncomingMessage`</a> | ||
#### <a name="request" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L255">`request :: Object -> Url -> Readable Buffer -> Future Error IncomingMessage`</a> | ||
|
||
This is the "lowest level" function for making HTTP requests. It does not | ||
handle buffering, encoding, content negotiation, or anything really. | ||
|
@@ -182,7 +182,7 @@ eventualBody.pipe (chain (sendBinary ('https://example.com'))); | |
If you want to use this function to transfer a stream of data, don't forget | ||
to set the Transfer-Encoding header to "chunked". | ||
|
||
#### <a name="retrieve" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L299">`retrieve :: Url -> StrMap String -> Future Error IncomingMessage`</a> | ||
#### <a name="retrieve" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L299">`retrieve :: Url -> StrMap String -> Future Error IncomingMessage`</a> | ||
|
||
A version of [`request`](#request) specialized in the `GET` method. | ||
|
||
|
@@ -193,7 +193,7 @@ makes a GET requests to the given resource. | |
retrieve ('https://api.github.com/users/Avaq') ({'User-Agent': 'Avaq'}) | ||
``` | ||
|
||
#### <a name="send" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L313">`send :: Mimetype -> Method -> Url -> StrMap String -> Buffer -> Future Error IncomingMessage`</a> | ||
#### <a name="send" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L313">`send :: Mimetype -> Method -> Url -> StrMap String -> Buffer -> Future Error IncomingMessage`</a> | ||
|
||
A version of [`request`](#request) for sending arbitrary data to a server. | ||
There's also more specific versions for sending common types of data: | ||
|
@@ -210,7 +210,7 @@ This function will always send the Content-Type and Content-Length headers, | |
alongside the provided headers. Manually provoding either of these headers | ||
override those generated by this function. | ||
|
||
#### <a name="sendJson" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L337">`sendJson :: Method -> String -> StrMap String -> JsonValue -> Future Error IncomingMessage`</a> | ||
#### <a name="sendJson" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L337">`sendJson :: Method -> String -> StrMap String -> JsonValue -> Future Error IncomingMessage`</a> | ||
|
||
A version of [`send`](#send) specialized in sending JSON. | ||
|
||
|
@@ -225,7 +225,7 @@ sendJson ('PUT') | |
({name: 'Bob', email: '[email protected]'}); | ||
``` | ||
|
||
#### <a name="sendForm" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L356">`sendForm :: Method -> String -> StrMap String -> JsonValue -> Future Error IncomingMessage`</a> | ||
#### <a name="sendForm" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L356">`sendForm :: Method -> String -> StrMap String -> JsonValue -> Future Error IncomingMessage`</a> | ||
|
||
A version of [`send`](#send) specialized in sending form data. | ||
|
||
|
@@ -240,7 +240,7 @@ sendForm ('POST') | |
({name: 'Bob', email: '[email protected]'}); | ||
``` | ||
|
||
#### <a name="acceptStatus" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L375">`acceptStatus :: Number -> IncomingMessage -> Future IncomingMessage IncomingMessage`</a> | ||
#### <a name="acceptStatus" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L375">`acceptStatus :: Number -> IncomingMessage -> Future IncomingMessage IncomingMessage`</a> | ||
|
||
This function "tags" an [IncomingMessage][] based on a given status code. | ||
If the response status matches the given status code, the returned Future | ||
|
@@ -253,7 +253,7 @@ you can then flatten it back into the outer Future. | |
|
||
The usage example under the [Http](#http) section shows this. | ||
|
||
#### <a name="bufferResponse" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L391">`bufferResponse :: Charset -> IncomingMessage -> Future Error String`</a> | ||
#### <a name="bufferResponse" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L391">`bufferResponse :: Charset -> IncomingMessage -> Future Error String`</a> | ||
|
||
A version of [`buffer`](#buffer) specialized in [IncomingMessage][]s. | ||
|
||
|
@@ -262,15 +262,15 @@ See also [`autoBufferResponse`](#autoBufferResponse). | |
Given a charset and an IncomingMessage, returns a Future with the buffered, | ||
encoded, message body. | ||
|
||
#### <a name="autoBufferResponse" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L404">`autoBufferResponse :: IncomingMessage -> Future Error String`</a> | ||
#### <a name="autoBufferResponse" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L404">`autoBufferResponse :: IncomingMessage -> Future Error String`</a> | ||
|
||
Given an IncomingMessage, buffers and decodes the message body using the | ||
charset provided in the message headers. Falls back to UTF-8 if the | ||
charset was not provided. | ||
|
||
Returns a Future with the buffered, encoded, message body. | ||
|
||
#### <a name="responseToError" href="https://github.com/fluture-js/fluture-node/blob/v2.1.0/index.js#L418">`responseToError :: IncomingMessage -> Future Error a`</a> | ||
#### <a name="responseToError" href="https://github.com/fluture-js/fluture-node/blob/v3.0.0/index.js#L418">`responseToError :: IncomingMessage -> Future Error a`</a> | ||
|
||
Given a response, returns a *rejected* Future of an instance of Error | ||
with a message based on the content of the response. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters