nika-begiashvili / libarchivejs

Archive library for browsers
MIT License
285 stars 35 forks source link

Error: Buffer exhausted #66

Closed sp90 closed 8 months ago

sp90 commented 8 months ago

I'm working with libarchive.js in the browser and it seems that I load the worker correctly when i try to create a ZIP using this code bit:

Screenshot 2024-01-22 at 13 22 25

I get Error: Buffer exhausted

Screenshot 2024-01-22 at 13 23 54

And in the worker reference, I get this code:

Screenshot 2024-01-22 at 13 23 59

I wanna disclaim I'm a bit in doubt about the compression and format what works together and how do i get a ZIP file

sp90 commented 8 months ago

If I then use the example config:

Screenshot 2024-01-22 at 13 31 57

I get 89 bytes based on compressing a 9756 bytes file and when I try to "unzip" I get this error I'm on mac

Screenshot 2024-01-22 at 13 33 39
nika-begiashvili commented 8 months ago

can you share log for fileMap ? also is passphrase set ?

sp90 commented 8 months ago

Same as the screenshot at the top 🙏🏼

nika-begiashvili commented 8 months ago

how many files are you using ?
can you try single file and see if issue persists ?
is passphrase set ?

sp90 commented 8 months ago

Its a single file in the array and the passphrase is null

sp90 commented 8 months ago

I can share the file; as buffer or whatever you need to replicate

nika-begiashvili commented 8 months ago

Yes, please share the file and a code so I could replicate

sp90 commented 8 months ago

I get a different error than the buffer exhausted in this example but maybe solving this might solve the other problem as well

https://github.com/sp90/test-archive/tree/main

I know it requires bun, it's just so much nicer to work with - I built a single executable for you to run without the use of bun

nika-begiashvili commented 8 months ago

I think there's exactly the same code as a test which is passing https://github.com/nika-begiashvili/libarchivejs/blob/master/test/files/write-archive.html so I can't see how I can reproduce this
does error occur with any file ?

sp90 commented 8 months ago

I think the difference is the linked example only extracts a zip I'm trying to create/write a zip :) and I get the error with any file I try to select small or big

nika-begiashvili commented 8 months ago

Can you try this file see if it works ? https://github.com/nika-begiashvili/libarchivejs/blob/master/test/files/write-archive.html

it also has download function for convenience

sp90 commented 8 months ago

I get this console error:

Screenshot 2024-01-25 at 15 51 29

I updated my repo with the code you gave me

Btw I'm greatly appreciative of your help!!

nika-begiashvili commented 8 months ago

I was able to reproduce it, I'll try to investigate

sp90 commented 8 months ago

Much appreciated

nika-begiashvili commented 8 months ago

Fixed in 0989c1a6db20d030d793b1763e20d880068091bd

sp90 commented 7 months ago

@nika-begiashvili it works flawless now thanks for the support on the topic