git-archive

0.1.4 • Public • Published

Git Archive

Module to take a bare git repo, archive it, and export it as a tarball to a given path

Build Status

Installation

npm install -S git-archive

Usage

Say for example you have a repo named apples and you want to export the repo as a tarball named apples.tar.gz in the current directory. The export archive must reference a sha1 hash

Promises

var gitArchive = require('git-archive')
 
var data = {
  commit: 'c3f9bcb782bcfc0216cef5c7f68f6f86cd3bea8a',
  outputPath: path.join(__dirname, 'apples.tar.gz'),
  repoPath: '/path/to/bare/repo.git'
}
 
gitArchive(data)
  .then(function(outputPath) {
    console.log('git archived to tarball at path %s', reply)
  })
  .fail(function(err) {
    console.dir(err)
    throw error // or pass the error to a callback
  }).done()
})

Callbacks

var gitArchive = require('git-archive')
 
var data = {
  commit: 'c3f9bcb782bcfc0216cef5c7f68f6f86cd3bea8a',
  outputPath: path.join(__dirname, 'apples.tar.gz'),
  repoPath: '/path/to/bare/repo.git'
}
 
gitArchive(data, function(err, reply) {
  var error
  if (err) {
    return console.dir(err)
  }
  console.log('git archived to tarball at path %s', reply)
})

Dependencies (4)

Dev Dependencies (3)

Package Sidebar

Install

npm i git-archive

Weekly Downloads

5

Version

0.1.4

License

BSD

Last publish

Collaborators

  • clewfirst