tiny-request
v2.0.0
Published
reed http body, write http body, pipe http body
Downloads
6
Readme
tiny-request
- a tiny http.request wrapper, useful for some http sdk modules.
usage
options: same to http.request options, add
timeout
,source
,body
,dest
support- timeout: type
{Number}
- source: type
{String} - filepath
|{Stream}
|{Buffer}
, will pipe to req - body: http body, type
{Buffer}
|{String}
|{Object}
- dest: filepath pipe from the res,
{String}
- rawBody: options pass to raw-body
- timeout: type
res: type
object
- status
- headers
- body
let request = require('tiny-request')
let result = await request(options)
request({
host: '',
port: '',
method: 'PUT',
source: __filename,
dest: __filename + '.temp'
}).then(function(res) {
// ...
}).catch(function(err) {
// ...
})
License
MIT