最佳答案
我试图使用 request
对 GET
进行二进制数据处理,结果得到了这样的结果:
var requestSettings = {
method: 'GET',
url: url,
};
request(requestSettings, function(error, response, body) {
// Use body as a binary Buffer
}
但是 body
总是与预期值有几个字节的差异。经过进一步调查,我发现 request
假定 body
是字符串,并替换了所有非 unicode 字节。
我想加上
encoding: 'binary'
但是没有用。
我怎样才能得到二进制数据?