Comments (3)
- This is not a typo. The
.pipe(destination)
returnsdestination
(see stream) so both implementations should work. - You do not need to include a promise library directly. If the promise is not called in your example it is possible that the
object.createReadStream()
didn't end? You can verify by putting.on('end', () => console.log('input stream ended'))
right after the.createReadStream()
The promise behaviour is tested here: https://github.com/ZJONSSON/node-unzipper/blob/master/test/parsePromise.js - please take a look and see if the test work when you adjust it to your example?
from node-unzipper.
Thank you for the prompt response @ZJONSSON.
It appears this is exactly my problem...
The library I'm using is not triggering end
, error
or finish
events even though the file is definitively created. Will pursue with those folks, thank you!
from node-unzipper.
Thanks for letting me know @DazWilkin . The input stream might possibly be missing the last bytes of the file as well, as the unzipper.Parse()
actually closes when the zip file is complete even though a formal end
event hasn't been received.
In any case, if you are getting all the zip entries you need through, you could "fake" an end
in a hacky way, if the input stream has remained silent for a time that is longer than any latency period in the pipeline.
Something like:
const Stream = require('stream');
class TimeoutStream extends Stream.Transform {
constructor(timeout) {
super();
this.timeout = timeout;
}
_transform(d, e, cb) {
clearTimeout(this._timeout);
this._timeout = setTimeout( () => this.end(), this.timeout);
cb(null, d);
}
}
object.createReadStream()
.pipe(new TimeoutStream(1000)) // automatically end after 1 sec inactivity
.pipe(unzipper.Parse())
......
Closing this - please post any new findings or reopen if you find any related unzipper
issues.
from node-unzipper.
Related Issues (20)
- 支持哪几种格式的解压? HOT 1
- unzipper failed. Emitted 'error' event on DuplexWrapper instance at HOT 2
- Issue with Incorrect Character Display in `fileName` HOT 2
- Open s3 very slow HOT 1
- How to use Open.url with native "fetch"? HOT 8
- buffers has no license HOT 4
- Byte Range for File Within an Archive HOT 5
- uncompressedSize always return 0 if zip file is download from google drive HOT 1
- 是否可以在 arkts 中使用
- Is there a way to pause reading entries the unzipper stream? HOT 2
- TypeError: Promise.map is not a function after upgrade to 0.11.3 HOT 4
- v0.11.3 is broken ? HOT 7
- Consider bounding the stream request when streaming entries HOT 3
- Error handling with customSource not hooked up correcly? HOT 3
- unzipper 0.11.5 completely breaks reading of docx files HOT 7
- Access the raw compressed data of an entry HOT 1
- offsetToLocalFileHeader greater than 32-bit int limit throws exceptions HOT 1
- [help] password file only can use open methods, but how to get entry - pathBuffer?
- Uncaught Error when using parseOne HOT 1
- Build fails without @aws-sdk/client-s3 package in package.json HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-unzipper.