Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-contrib-compress

Package Overview
Dependencies
Maintainers
3
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-contrib-compress - npm Package Compare versions

Comparing version 0.4.4 to 0.4.5

4

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc