Created
November 19, 2015 07:58
-
-
Save yandongxu/1856c4122ebeab6ec48f to your computer and use it in GitHub Desktop.
request + iconv-lite = awesome
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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