Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Two-Screen/grunt-zipstream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This module no longer works in Node 0.10. Please use grunt-contrib-compress instead.


grunt-zipstream

Create ZIP files with zipstream.

Getting Started

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');

The "zip" task

Overview

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
        }
      }
    }
  }
});

Options

options.base

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.

options.subdir

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.

options.zlib

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.

License

Copyright (c) 2013 Stéphan Kochen
Licensed under the MIT license.

About

Create ZIP files from grunt with zipstream.

Resources

License

Stars

Watchers

Forks

Packages

No packages published