I am busy with a project that uses http module to receive requests. I posted a binary file (.deb) as a application/octet-stream body using curl ( curl -POST -H "Content-Encoding: base64" -H "Content-Type: application/octet-stream" --data '@package.deb' 'http://localhost/binary' ). I then used req.on("data") and req.on("end") handlers (where req is instance of http.IncomingMessage) and cast combine the chunks into one UInt8Array to save to disk. When looking at the bytes in the debugger, it corresponds with hexdump -C package.deb. However, when I write out the Uint8Array data to a file and perform a hexdump on it, a 16 bit endian problem switches every two bytes around. I tried it with fs as well as fs-extra (which I assume is only a wrapper) and got exactly the same result.
fs-extra
version: 10.0.1I am busy with a project that uses http module to receive requests. I posted a binary file (.deb) as a application/octet-stream body using curl ( curl -POST -H "Content-Encoding: base64" -H "Content-Type: application/octet-stream" --data '@package.deb' 'http://localhost/binary' ). I then used req.on("data") and req.on("end") handlers (where req is instance of http.IncomingMessage) and cast combine the chunks into one UInt8Array to save to disk. When looking at the bytes in the debugger, it corresponds with hexdump -C package.deb. However, when I write out the Uint8Array data to a file and perform a hexdump on it, a 16 bit endian problem switches every two bytes around. I tried it with fs as well as fs-extra (which I assume is only a wrapper) and got exactly the same result.