jstuckey / gulp-gzip

Gzip plugin for gulp.
MIT License
175 stars 17 forks source link

Sync gz times from original #10

Closed larvanitis closed 9 years ago

larvanitis commented 9 years ago

Would it be possible to add an option so that the ctime and mtime of the created gz files match those of the src file?

jstuckey commented 9 years ago

Is this specific to gulp-gzip or gulp as a whole? Just running something like gulp.src('*').pipe(gulp.dest('.')); will modify mtime.

larvanitis commented 9 years ago

Hmmm good question. My use case involves just the gzip part - ie I process all files and the last step before dest is gzip. Are the times controllable by gulp or would a plugin have to do some magic changing them after the files have been written to the disk?

jstuckey commented 9 years ago

I think the timestamps will be updated for any file run through Gulp regardless of gulp-gzip being included.

The only plugin I found that involves mtime is gulp-rev-mtime, but that's not really what you're after. This might be a good idea for a new Gulp plugin!

The fs module has a Stats class, which contains atime, ctime, and mtime. That might be helpful.

callumacrae commented 9 years ago

Yeah, this isn't something a plugin can do. vinyl-fs, the vinyl adapter that gulp uses, doesn't support it.

In theory you could modify vinyl-fs so that the times are retained.