request-gb

0.1.8 • Public • Published

request-gb

Build Status Coverage Status npm version Dependency Status

https://www.npmjs.org/package/request-gb

This module extends request/request's Request class with a automatic Chinese encoding conversion.

It is backed by the request module, so see its README for more details.

Installation

    $ npm install request-gb

Example

// get a page
var request = require('request-gb');
request.get('http://www.xxx.com', {gzip:true}, function(err, res){
   console.log(res);
});
 
// download a file
request.download(
    'http://gravatar.com/avatar/84cbf739853b2e023328e2c0428d663c',
    'http://en.gravatar.com/',
    {gzip:true},
    '/users/xxx/avatar.jpg',
    function(err, res){
        console.log(res.length);
    });
 
// read file data into a Buffer
request.download2Buffer(
    'http://gravatar.com/avatar/84cbf739853b2e023328e2c0428d663c',
    'http://en.gravatar.com/',
    {gzip:true},
    function(err, buf){
        console.log(buf.length);
    });

License

MIT

Package Sidebar

Install

npm i request-gb

Weekly Downloads

4

Version

0.1.8

License

MIT

Last publish

Collaborators

  • moyerock