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

Extraction of archive not completed, in some cases, when integrating with fs.createReadStream.pipe() #335

Open
nlisgo opened this issue Aug 6, 2024 · 1 comment

Comments

@nlisgo
Copy link

nlisgo commented Aug 6, 2024

await fs.createReadStream('/path/to/source.zip')
  .pipe(unzipper.Extract({ path: '/path/to/destination' }))
  .promise();

We found the above approach sometimes resulted in not all files in the archive been extracted and with no error thrown. We resolved by refactoring and dropping the use of fs

await unzipper.Open.file(mecaPath)
  .then((dir) => dir.extract({
    path: tmpDirectory,
  }));

See: elifesciences/enhanced-preprints-import@7dcac0c

I'm prepared to provide more information and perhaps some example code demonstrating different outcomes for both. I'm posting here, not because I'm certain this is a bug but in case it is and I want to support the project in helping to fix it.

I also thought it may be useful for others who may have experienced the same issue to see how it can be resolved.

@nlisgo nlisgo changed the title Extraction of archive not completed when integrating with fs.createReadStream.pipe() Extraction of archive not completed, in some cases, when integrating with fs.createReadStream.pipe() Aug 6, 2024
@farz4n3hhl
Copy link

Hi @nlisgo

I had the same issue in my project!

After struggling a lot, upgrading the package to the latest version ([email protected]) seems to have fixed the problem.

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

2 participants