Various async utility functions
stream
<stream.Readable> The stream to slurpencoding
<string> The character encoding to use. All encodings supported by the node Buffer API are accepted. Use 'raw' to return the buffer itself. Default:'utf-8'
- Returns: <Promise<string>|<Buffer>>
"Slurps" the given stream; all remaining data will be consumed and returned.
Note: This function rejects if the stream emits an 'error'
event.
options
<Object> | <string> | <URL> Seehttps.request
body
<string> | <Buffer> The body of the request. Useundefined
for no body.encoding
<string> The character encoding to use. Uses the same format asslurp
- Returns: <Promise<Object>> (See
msgToObj
)
Sends a HTTPS request to the specified server. The resulting response is passed to msgToObj, the result of which is returned.
options
<Object> | <string> | <URL> Seehttp.request
body
<string> | <Buffer> The body of the request. Useundefined
for no body.encoding
<string> The character encoding to use. Uses the same format asslurp
- Returns: <Promise<Object>> (See
msgToObj
)
Sends a HTTP request to the specified server. This function acts just as request
does otherwise.
message
<http.IncomingMessage> | <http.ServerResponse> The message to convert
Converts message
into an equivalent object with an added data
property and toString
function.
Note: Due to the implementation of this function, properties from the message may be dropped. If this includes a property you need, please file a bug report.
ms
[<number>][number] How long to sleep for
An alias for setTimeout[util.promisify.custom]
.