Comments (3)
Hi @saracen
Thanks for the quick answer! WithStageDirectory
is a perfectly fine option (at least for me). As long as the last modified date isn't reset, everything is fine (I don't want to harm concurrency because I like Archiver for its incredible speed. E.g. Archiver vs 7-Zip: Archiver it's a lot faster for the test folder with 2000 files and 300 folders).
Additionally, thanks a lot for the example how to set up the temp folder and providing the necessary option to Archiver!
Take your time if you really want to look deeper into this 'issue', it isn't urgent (any more) :)
Merry Christmas!
from fastzip.
Hey @oO0XX0Oo
Unfortunately I'm not going to have a chance to look at this in detail probably for a week or so.
However, I think I know what the issue is: For concurrent archiving, where multiple files are compressed at the same time, a staging directory is used. This staging directory is by default the directory to be archived.
You can change the staging directory's location by passing the option: WithStageDirectory
. Alternatively, using the option WithArchiverConcurrency(1)
will stop concurrent archiving, and therefore also not create any files in the staging directory - but will impact performance.
For changing the staging directory, you could do something like this:
tmp, err := ioutil.TempDir("", "fastzip")
if err != nil {
return err
}
defer os.RemoveAll(tmp) // delete tmp directory after archiving complete
a, err := fastzip.NewArchiver(w, "~/fastzip-archiving", fastzip.WithStageDirectory(tmp))
...
This will then use the operating system's default directory for temporary files. This isn't the default to avoid cross-filesystem problems. However, when this decision was made, I didn't foresee this directory modification date issue. I'll think on this further. At the very least, the documentation should make it clear that by default, the directory to be archived is used to stage files in (and then they're cleaned up).
from fastzip.
Unfortunately, a somehow related issue...
This is only valid for the Windows operating systems!
When Archiver stores the file dates from the files/folders inside the source path it sets the last modified time (sometimes it's called "birth time") to time.Now() instead of using the existing time.
The same goes for Extractor. When it extracts an archive, the last modified date is set to time.Now() as well...
Can you consider importing the times library: https://github.com/djherbis/times
and store/restore the correct last modified time instead?
Thanks a lot,
oO0XX0Oo
from fastzip.
Related Issues (9)
- Zips created in windows are not valid in linux due to the invalid separator HOT 3
- zip: not a valid zip file HOT 2
- add custom root folder during archival? HOT 2
- Decompressed file content is messed up HOT 10
- Add support for z/OS
- Preserve timestamps of symlinks
- the passwd is error when i use encrypt zip at the first
- Prevent unnecessary directory in zip? HOT 3
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 fastzip.