You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
613 B
27 lines
613 B
'use strict';
|
|
|
|
var request = require('../');
|
|
|
|
async function main() {
|
|
var tpath = '/tmp/google-index.html';
|
|
var resp = await request({
|
|
url: 'https://google.com',
|
|
encoding: null,
|
|
stream: tpath
|
|
});
|
|
console.log('[Response Headers]');
|
|
console.log(resp.toJSON().headers);
|
|
|
|
//console.error(resp.headers, resp.body.byteLength);
|
|
await resp.stream;
|
|
console.log('[Response Body] written to', tpath);
|
|
}
|
|
|
|
main()
|
|
.then(function () {
|
|
console.log('Pass');
|
|
})
|
|
.catch(function (e) {
|
|
console.error('Fail');
|
|
console.error(e.stack);
|
|
});
|
|
|