diff --git a/README.md b/README.md index 66830b5..1b25b58 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ $ npm install fluture fluture-node ### EventEmitter -#### `once :: String -⁠> EventEmitter -⁠> Future Error a` +#### `once :: String -⁠> EventEmitter -⁠> Future Error 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 -#### `encode :: Charset -⁠> Buffer -⁠> Future Error String` +#### `encode :: Charset -⁠> Buffer -⁠> Future Error String` 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 -#### `streamOf :: Buffer -⁠> Future a (Readable Buffer)` +#### `streamOf :: Buffer -⁠> Future a (Readable Buffer)` 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. -#### `emptyStream :: Future a (Readable Buffer)` +#### `emptyStream :: Future a (Readable Buffer)` A [Readable][] stream which ends after emiting zero bytes. Can be useful as an empty [`request`](#request) body, for example. -#### `buffer :: Readable a -⁠> Future Error (Array a)` +#### `buffer :: Readable a -⁠> Future Error (Array 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')]); ``` -#### `bufferString :: Charset -⁠> Readable Buffer -⁠> Future Error String` +#### `bufferString :: Charset -⁠> Readable Buffer -⁠> Future Error String` 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 -#### `instant :: b -⁠> Future a b` +#### `instant :: b -⁠> Future a b` 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') ``` -#### `immediate :: b -⁠> Future a b` +#### `immediate :: b -⁠> Future a b` 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. -#### `request :: Object -⁠> Url -⁠> Readable Buffer -⁠> Future Error IncomingMessage` +#### `request :: Object -⁠> Url -⁠> Readable Buffer -⁠> Future Error IncomingMessage` 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". -#### `retrieve :: Url -⁠> StrMap String -⁠> Future Error IncomingMessage` +#### `retrieve :: Url -⁠> StrMap String -⁠> Future Error IncomingMessage` 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'}) ``` -#### `send :: Mimetype -⁠> Method -⁠> Url -⁠> StrMap String -⁠> Buffer -⁠> Future Error IncomingMessage` +#### `send :: Mimetype -⁠> Method -⁠> Url -⁠> StrMap String -⁠> Buffer -⁠> Future Error IncomingMessage` 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. -#### `sendJson :: Method -⁠> String -⁠> StrMap String -⁠> JsonValue -⁠> Future Error IncomingMessage` +#### `sendJson :: Method -⁠> String -⁠> StrMap String -⁠> JsonValue -⁠> Future Error IncomingMessage` A version of [`send`](#send) specialized in sending JSON. @@ -225,7 +225,7 @@ sendJson ('PUT') ({name: 'Bob', email: 'bob@example.com'}); ``` -#### `sendForm :: Method -⁠> String -⁠> StrMap String -⁠> JsonValue -⁠> Future Error IncomingMessage` +#### `sendForm :: Method -⁠> String -⁠> StrMap String -⁠> JsonValue -⁠> Future Error IncomingMessage` A version of [`send`](#send) specialized in sending form data. @@ -240,7 +240,7 @@ sendForm ('POST') ({name: 'Bob', email: 'bob@example.com'}); ``` -#### `acceptStatus :: Number -⁠> IncomingMessage -⁠> Future IncomingMessage IncomingMessage` +#### `acceptStatus :: Number -⁠> IncomingMessage -⁠> Future IncomingMessage IncomingMessage` 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. -#### `bufferResponse :: Charset -⁠> IncomingMessage -⁠> Future Error String` +#### `bufferResponse :: Charset -⁠> IncomingMessage -⁠> Future Error String` A version of [`buffer`](#buffer) specialized in [IncomingMessage][]s. @@ -262,7 +262,7 @@ See also [`autoBufferResponse`](#autoBufferResponse). Given a charset and an IncomingMessage, returns a Future with the buffered, encoded, message body. -#### `autoBufferResponse :: IncomingMessage -⁠> Future Error String` +#### `autoBufferResponse :: IncomingMessage -⁠> Future Error String` Given an IncomingMessage, buffers and decodes the message body using the charset provided in the message headers. Falls back to UTF-8 if the @@ -270,7 +270,7 @@ charset was not provided. Returns a Future with the buffered, encoded, message body. -#### `responseToError :: IncomingMessage -⁠> Future Error a` +#### `responseToError :: IncomingMessage -⁠> Future Error a` Given a response, returns a *rejected* Future of an instance of Error with a message based on the content of the response. diff --git a/package.json b/package.json index 864f7a8..8f69c49 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fluture-node", - "version": "2.1.0", + "version": "3.0.0", "description": "FP-style HTTP and streaming utils for Node based on Fluture", "keywords": [ "buffer",