JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3272
  • Score
    100M100P100Q124684F
  • License MIT

add charset support for node's superagent

Package Exports

  • superagent-charset

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (superagent-charset) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

superagent-charset

add charset support for node's superagent

Build Status Coverage Status npm version npm downloads npm license Greenkeeper badge

Install

$ npm i superagent-charset --save

API

install

const request = require('superagent')
require('superagent-charset')(request)

this will add request.Request.prototype.charset

charset

.charset(encoding) , will passed to iconv-lite

const should = require('should')
const request = require('superagent')
require('superagent-charset')(request) // install charset

describe('Basic Test', function() {
  it('it works', function(done) {
    request.get('http://www.sohu.com/')
      .charset('gbk')
      .end((err, res) => {
        res.text.should.match(/搜狐/)
        done(err)
      })
  })
})

License

the MIT License, http://magicdawn.mit-license.org