Skip to content

Instantly share code, notes, and snippets.

@yandongxu
Created November 19, 2015 07:58
Show Gist options
  • Save yandongxu/1856c4122ebeab6ec48f to your computer and use it in GitHub Desktop.
Save yandongxu/1856c4122ebeab6ec48f to your computer and use it in GitHub Desktop.
request + iconv-lite = awesome
import request from 'request';
import iconv from 'iconv-lite';
request
.get(tb)
.pipe(iconv.decodeStream('gbk'))
// Sugar: all encode/decode streams have .collect(cb) method to accumulate data.
.collect(function (err, body) {
console.log(body);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment