-
Notifications
You must be signed in to change notification settings - Fork 7
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
Cannot download PNG file with iValue.download() method #186
Comments
File signature when catting an image looks like:
For both good and invalid PNGs. |
Jpeg throws Crc error |
File downloaded via Firefox and file downloaded via Flagpole have differences on every line when both are converted to hex. |
Stripping out the needle.request() method and using it on its own correctly downloads the file. It is getting corrupted somewhere after that. |
It is getting corrupted in the process of turning a Needle response into an HttpResponse |
I think it's because the PNG buffer is being turned into a string with utf8 encoding. It should probably be base64. |
There is corruption taking place even when I use base64 |
The conversion of buffer to string in the constructor for HttpResponse is responsible for the corruption. What do I break if I take out the call to JSON.stringify()? |
Description
PNG files can't be downloaded using the .download() method. Possibly other files also have this problem. fsWriteSync throws an error that the file signature is invalid.
Steps to reproduce
Expected behavior
File downloaded correctly
Actual behavior
Invalid file signature error thrown; corrupt image file saved to filesystem
The text was updated successfully, but these errors were encountered: