This module no longer works in Node 0.10. Please use grunt-contrib-compress instead.
Create ZIP files with zipstream.
This plugin requires Grunt 0.4.0
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-zipstream --save-dev
One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-zipstream');
In your project's Gruntfile, add a section named zip
to the data object
passed into grunt.initConfig()
.
grunt.initConfig({
zip: {
your_target: {
src: [
'static/images/**/*',
'static/index.html',
'README.md'
],
dest: 'package.zip',
/* optional */
options: {
base: 'some/path/',
subdir: 'mypackage/',
zlib: {
level: 1
}
}
}
}
});
Type: String
A base path that will be stripped off the start of filenames in the zip file. If you're stripping directories off a path, you usually want to have this end with a slash. Because this is a simple string operation, you would otherwise end up with absolute paths in the zip file.
Type: String
A base path that will be added to the start of filenames in the zip file.
Usually, this will be the name of the directory you want the zip file to unpack
to. Note that trailing slashes are important here too, as with options.base
.
Type: Object
Any additional options for the Node.js zlib
module. See
the zlib
documentation for specifics, but the most useful will be the
level
option controlling compression level.
Copyright (c) 2013 Stéphan Kochen
Licensed under the MIT license.