grunt-contrib-compress
Advanced tools
Comparing version 0.4.4 to 0.4.5
{ | ||
"name": "grunt-contrib-compress", | ||
"description": "Compress files and folders.", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"homepage": "https://github.com/gruntjs/grunt-contrib-compress", | ||
@@ -31,3 +31,3 @@ "author": { | ||
"dependencies": { | ||
"archiver": "~0.3.0", | ||
"archiver": "~0.4.1", | ||
"prettysize": "~0.0.2" | ||
@@ -34,0 +34,0 @@ }, |
@@ -97,2 +97,3 @@ # grunt-contrib-compress [![Build Status](https://secure.travis-ci.org/gruntjs/grunt-contrib-compress.png?branch=master)](http://travis-ci.org/gruntjs/grunt-contrib-compress) | ||
* 2013-03-19 v0.4.5 Update to archiver 0.4.1 | ||
* 2013-03-18 v0.4.4 Fixes for Node.js v0.10. Explicitly call grunt.file methods with map and filter. | ||
@@ -115,2 +116,2 @@ * 2013-03-13 v0.4.3 Fix for gzip; continue iteration on returning early. | ||
*This file was generated on Tue Mar 19 2013 10:17:48.* | ||
*This file was generated on Wed Mar 20 2013 16:00:56.* |
@@ -23,2 +23,27 @@ /* | ||
// Helper for gziping more reliably | ||
function gzip(engine, buffer, callback) { | ||
var buffers = []; | ||
var nread = 0; | ||
function flow() { | ||
var chunk; | ||
while (null !== (chunk = engine.read())) { | ||
buffers.push(chunk); | ||
nread += chunk.length; | ||
} | ||
engine.once('readable', flow); | ||
} | ||
engine.on('error', function(err) { | ||
callback(err); | ||
}); | ||
engine.on('end', function() { | ||
var buf = Buffer.concat(buffers, nread); | ||
buffers = []; | ||
callback(null, buf); | ||
engine.close(); | ||
}); | ||
engine.end(buffer); | ||
flow(); | ||
} | ||
// 1 to 1 gziping of files | ||
@@ -44,6 +69,5 @@ exports.gzip = function(files, done) { | ||
var gz = zlib.createGzip(exports.options); | ||
gz.pipe(fs.createWriteStream(file.dest)); | ||
gz.write(src); | ||
gz.end(); | ||
gz.on('end', function() { | ||
gzip(gz, src, function(err, buf) { | ||
if (err) { return grunt.log.error(err); } | ||
grunt.file.write(file.dest, buf.toString()); | ||
grunt.log.writeln('File ' + String(file.dest).cyan + ' created (' + exports.getSize(file.dest) + ').'); | ||
@@ -79,8 +103,4 @@ next(); | ||
// Whether to gzip the tar before writing the file | ||
if (shouldGzip) { | ||
archive.pipe(zlib.createGzip()).pipe(fs.createWriteStream(dest)); | ||
} else { | ||
archive.pipe(fs.createWriteStream(dest)); | ||
} | ||
// Where to write the file | ||
archive.pipe(fs.createWriteStream(dest)); | ||
@@ -96,3 +116,3 @@ grunt.util.async.forEachSeries(files, function(file, next) { | ||
archive.addFile(fs.createReadStream(srcFile), { name: internalFileName }, function(err) { | ||
archive.append(fs.createReadStream(srcFile), { name: internalFileName }, function(err) { | ||
grunt.verbose.writeln('Archiving ' + srcFile.cyan + ' -> ' + String(dest).cyan + '/'.cyan + internalFileName.cyan); | ||
@@ -107,7 +127,13 @@ nextFile(err); | ||
if (shouldGzip) { | ||
grunt.log.writeln('Created ' + String(dest).cyan + ' (' + exports.getSize(dest) + ')'); | ||
var gz = zlib.createGzip(exports.options); | ||
var data = grunt.file.read(dest); | ||
gzip(gz, data, function(err, buf) { | ||
grunt.file.write(dest, buf.toString()); | ||
grunt.log.writeln('Created ' + String(dest).cyan + ' (' + exports.getSize(dest) + ')'); | ||
done(); | ||
}); | ||
} else { | ||
grunt.log.writeln('Created ' + String(dest).cyan + ' (' + exports.getSize(Number(written)) + ')'); | ||
done(); | ||
} | ||
done(); | ||
}); | ||
@@ -114,0 +140,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32541
303
116
+ Addedarchiver@0.4.10(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedreadable-stream@1.0.34(transitive)
+ Addedstring_decoder@0.10.31(transitive)
- Removedarchiver@0.3.0(transitive)
- Removedgraceful-fs@1.1.14(transitive)
- Removedlodash@0.10.0(transitive)
- Removedmkdirp@0.3.5(transitive)
- Removedrimraf@2.0.3(transitive)
Updatedarchiver@~0.4.1