2.0.0 • Published 11 years ago
tiny-request v2.0.0
tiny-request
- a tiny http.request wrapper, useful for some http sdk modules.
usage
options: same to http.request options, add
timeout,source,body,destsupport- 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