Skip to content
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

zip files as data uri #334

Open
ecofi opened this issue Aug 3, 2024 · 0 comments
Open

zip files as data uri #334

ecofi opened this issue Aug 3, 2024 · 0 comments

Comments

@ecofi
Copy link

ecofi commented Aug 3, 2024

I'm facing a strange issue. I'm using unzipper.Open.custom() in combination with readable stream converted from native fetch webstream with Nodejs v. 22. This is working fine for URLs with protocol http / https. However, when I'm using base64 data urls (data:application/zip;base64,...), the directory values are incorrect and the file.path includes large (binary?) strings, such as:

offsetToLocalFileHeader: 1928964777, lastModifiedDateTime: 2017-03-09T18:12:58.000Z, pathBuffer: <Buffer d6 5b 37 af 14 e0 aa 7a be cc 7a 56 f3 4a 01 ae 82 12 0e d1 b6 67 62 45 a9 e3 a4 94 7c b1 da 38 f3 f2 58 92 12 67 0b ec fd 36 2e 79 b1 86 44 de 88 45 ... 3940 more bytes>, path: '�[7�\x14�z��zV�J\x01��\x12\x0EѶgbE�㤔|��8��X�\x12g\x0B��6.y��DވE\x03r#�G���=$���V��3)\t���ǥt^\x1C�\x1B�\x07�-�o�[N��Jbе\x17�\x1E}����D��RCLV�tuTg��yN�yYj�ѭB�_�O����/��q$l����Ѧ\x7F~�k4eN\x10v�*�j~mM�J�#(/\x15�>��Jy����\'�+i�\x18"�����[q79Qr��܋�!\bs\x0F�K�\x05�X��,�IK\x12�\x13��\x02kYxZ�Ĝh0\x7F\x06�I�\x15!8��V��BF~\x16Q�(Rgw®s\x14\x03��\x1F3,=\x06�ה$�"�2�\x04�8s\x1EI��=kd����R�֧%x�Ǿ\x16l���#V\x1F\\q���BP\x0FN����lh׋����oP�\x00,p�6z�\x05��AW~�m\x1B\x13����\n' +
'�Ӱ\tv\x7F�m�LJ��\x16�!-OS�6\x06`

Usually, native fetch can be used for data URL and I'm not sure why data URLs causing this issue here.

If I'm not using stream but convert the native fetch request of dataURL first in a buffer and open with unzipper.Open.buffer() it is also working fine. But I would like to avoid the buffer method as this is costing extra memory (i.e. base64 string and and additional buffer variable).

What could be this issue here. I already tested different mime declarations for the data URL but all result in the same result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant