Getting binary content in Node.js using request -
i trying get binary info using request, , had like:
var requestsettings = { method: 'get', url: url, }; request(requestsettings, function(error, response, body) { // utilize body binary buffer } but body few bytes different expected. after farther investigation found out request assumed body string , replaced non-unicode bytes.
i tried add
encoding: 'binary' to requestsettings didn't help.
how can binary data?
ok, after lot of digging, found out requestsettings should have:
encoding: null and body of type buffer, instead of default, string.
node.js request binaryfiles
No comments:
Post a Comment