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

grunt-contrib-compress

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-contrib-compress

Compress files and folders.

  • 0.3.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43K
decreased by-1.92%
Maintainers
2
Weekly downloads
 
Created
Source

grunt-contrib-compress Build Status

Compress files and folders.

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-contrib-compress

Then add this line to your project's grunt.js gruntfile:

grunt.loadNpmTasks('grunt-contrib-compress');

Overview

Inside your grunt.js file, add a section named compress. This section specifies the files to compress and the options passed to either archiver (for zip) or tar (for tar/tgz) or zlib (for gzip).

Parameters
files object

This defines what files this task will compress and should contain key:value pairs.

The key (destination) should be an unique filepath (supports grunt.template) and the value (source) should be a filepath or an array of filepaths (supports minimatch).

options object

This controls how this task operates and should contain key:value pairs, see options below.

Options
mode string

This is used to define which mode to use, currently supports gzip, tar, tgz (tar gzip) and zip.

As of v0.3.0, this is now automatically detected per dest:src pair but can be overridden per target if desired.

basePath string

This option adjusts internal filenames to be relative to provided path, within the resulting archive file.

This has been automatically detected per dest:src pair for some time now but can be overridden per target if desired.

flatten boolean

This option performs a flat copy that dumps all the files into the root of the destination file, overwriting files if they exist.

level integer (zip only)

This option sets the level of archive compression (defaults to 1).

Currently, gzip compression related options are not supported due to deficiencies in node's zlib library.

rootDir string

This option allows the creation of a root folder to contain files within the resulting archive file.

Config Example
compress: {
  zip: {
    files: {
      "path/to/result.zip": "path/to/source/*", // includes files in dir
      "path/to/another.tar": "path/to/source/**", // includes files in dir and subdirs
      "path/to/final.tgz": ["path/to/sources/*.js", "path/to/more/*.js"], // include JS files in two diff dirs
      "path/to/single.gz": "path/to/source/single.js", // gzip a single file
      "path/to/project-<%= pkg.version %>.zip": "path/to/source/**" // variables in destination
    }
  }
}

--

Task submitted by Chris Talkington.

Keywords

FAQs

Package last updated on 05 Dec 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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