mirror of https://github.com/schollz/croc.git
use best speed
This commit is contained in:
parent
09a16cacd5
commit
4e88975ed4
|
@ -61,11 +61,13 @@ func (c *Croc) processFile(src string) (err error) {
|
||||||
fd.IsDir = info.Mode().IsDir()
|
fd.IsDir = info.Mode().IsDir()
|
||||||
|
|
||||||
// zip file
|
// zip file
|
||||||
|
log.Debug("zipping file")
|
||||||
c.crocFile, err = zipFile(path.Join(pathToFile, filename), c.UseCompression)
|
c.crocFile, err = zipFile(path.Join(pathToFile, filename), c.UseCompression)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
log.Debug("...finished zipping")
|
||||||
fd.IsCompressed = c.UseCompression
|
fd.IsCompressed = c.UseCompression
|
||||||
fd.IsEncrypted = c.UseEncryption
|
fd.IsEncrypted = c.UseEncryption
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ func zipFile(fname string, compress bool) (writtenFilename string, err error) {
|
||||||
zipWriter := zip.NewWriter(newfile)
|
zipWriter := zip.NewWriter(newfile)
|
||||||
zipWriter.RegisterCompressor(zip.Deflate, func(out io.Writer) (io.WriteCloser, error) {
|
zipWriter.RegisterCompressor(zip.Deflate, func(out io.Writer) (io.WriteCloser, error) {
|
||||||
if compress {
|
if compress {
|
||||||
return flate.NewWriter(out, flate.BestCompression)
|
return flate.NewWriter(out, flate.BestSpeed)
|
||||||
} else {
|
} else {
|
||||||
return flate.NewWriter(out, flate.NoCompression)
|
return flate.NewWriter(out, flate.NoCompression)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue