1.3.4 • Published 10 years ago

@yaws/zip-dir v1.3.4

Weekly downloads
-
License
MIT
Repository
github
Last release
10 years ago

zip-dir

Build status Git tag NPM version Code style

Zip a directory.

Installation

$ npm install @yaws/zip-dir

Usage

var zipDir = require('@yaws/zip-dir')
var co = require('co')
var hash = require('hasha')

co(function * () {
  var code = yield zipDir('./')
  var hash = hasha(code, {encoding: 'base64', alrogirthm: 'sha256'})
  s3.putObject({Bucket: 'code', Key: hash, Body: code})
})

// or

co(function * () {
  var code = yield zipDir(content)
  var hash = hasha(code, {encoding: 'base64', alrogirthm: 'sha256'})
  s3.putObject({Bucket: 'code', Key: hash, Body: code})
})

function content (zip) {
  zip.directory('./')
  zip.append('{"USER": "josh"}', '.env.json')
}

API

zipDir(src)

  • src {String} - Path to the directory to zip.
  • src {Function} - The function defines the sources using the zip api that is passed to it. The functions signature is src(zip). zip has three methods:
    • directory(path, dest)
    • file(path, opts|name)
    • append(src, opts|name)

Returns: a promise for a buffer of the zipped contents

License

MIT

1.3.4

10 years ago

1.3.3

10 years ago

1.3.2

10 years ago

1.3.1

10 years ago

1.3.0

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.1

10 years ago

1.0.0

10 years ago