ZJONSSON / node-unzipper

node.js cross-platform unzip using streams
Other
435 stars 116 forks source link

README needs an example of how to handle directories #276

Closed ianengelbrecht closed 3 months ago

ianengelbrecht commented 1 year ago

If we get a directory while iterating over zip file entries, i.e. entry.type == 'Directory', how do we then handle each entry in that directory. It has to be with recursion, right? Do we need to pipe the directory to another unzipper.Parse() instance? How do we know when we're got a file out of that directory?

ZJONSSON commented 3 months ago

You don't need to handle Directory. I mean, you could go ahead and create the directory if you want or simply ignore it. All files within directories are going to have the directory in the filename.

In the native extract method, we used to ignore directories, but in the latest release we create them even if they end up being empty (v0.12.1)