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 events #35

Open
mbrio opened this issue Mar 11, 2016 · 3 comments
Open

Extraction events #35

mbrio opened this issue Mar 11, 2016 · 3 comments

Comments

@mbrio
Copy link

mbrio commented Mar 11, 2016

A nice addition to this package would be emitting events such as progress and entry so that implementers can see how far along they are with their decompression and to know what the currently decompressing or decompressed file is.

const zip = new Decompress()
  .src(src)
  .dest(dest)
  .use(Decompress.zip())
  .on('progress', pe => {
    if (pe.lengthComputable) {
      const percent = Math.round(pe.decompressed / pe.total * 100);
      console.log(`${percent}% complete`);
    }
  })
  .on('entry', entry => {
    console.log(`Currently decompressing ${entry.fileName}.`);
  })
  .run();

The progress event data I modeled after the Web API standard: https://developer.mozilla.org/en-US/docs/Web/API/ProgressEvent and modified loaded to decompressed.

The entry event data I modeled after information found in the zip specification on wikipedia.

@alandoyle95
Copy link

+1 really want this

@lefuturiste
Copy link

+1

1 similar comment
@yykoypj
Copy link

yykoypj commented Jan 12, 2024

+1

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

4 participants