Questions tagged «requestjs»

2
使用请求在Node.js中获取二进制内容
我尝试使用GET进行二进制数据处理request,结果如下: var requestSettings = { method: 'GET', url: url, }; request(requestSettings, function(error, response, body) { // Use body as a binary Buffer } 但是body总是与预期有几个字节的差异。经过进一步调查,我发现request假定body为字符串,并替换了所有非Unicode字节。 我试图添加 encoding: 'binary' ,requestSettings但没有帮助。 如何获取二进制数据?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.