-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PUT padding small binary files #725
Comments
It's not just PUT, I can confirm POST does it as well. Looks like an issue when using axios from newer versions of Node and passing a buffer to axios that is less than the size of the Buffer.poolSize, which is typically 8192 bytes. If the buffer will fit in the pool, node doesn't allocate its own memory. What axios's node adapter appears to be doing is copying the entire 8192 bytes and sending the entire internal Buffer pool rather than just the file data. That is why the Content Size show 8192 and the data payload will contain random data. https://nodejs.org/api/buffer.html#buffer_class_method_buffer_allocunsafe_size
|
Closing as we'll track this in #774 that has more information. Thanks for reporting! |
I'm attempting to use axios to do a PUT to a url. I read the file off disk using fs.readFileSync into a buffer. I have confirmed that the file read in is the size I expect (908 bytes). However the uploaded file is 8192 bytes, and a hexdump of the uploaded file shows it is padded with 0s. I have confirmed that at the time xhr receives the data it has already been padded. Oddly this does not appear to happen with larger files over 8192.
The text was updated successfully, but these errors were encountered: