deterministic-tar

0.2.0 • Public • Published

deterministic-tar

generate/transform a tarball that hashes consistently.

strips out timestamps, user ids, and optional trailing null blocks.

Example

var http = require('https')
var deterministic = require('./')
var zlib = require('zlib')
var crypto = require('crypto')
 
var hash = crypto.createHash('sha256')
 
var url = 
  'https://codeload.github.com/dominictarr/deterministic-tar/tar.gz/master'
 
http.get(url, function (stream) {
  stream
    .pipe(zlib.createGunzip())
 
    // force the tarball to be deterministic!
    .pipe(deterministic())
 
    .on('data', function (data) {
      hash.update(data)
    })
    .on('end', function () {
      console.log(hash.digest('hex'))
    })
})

License

MIT

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i deterministic-tar

    Weekly Downloads

    6

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    3.79 kB

    Total Files

    6

    Last publish

    Collaborators

    • nopersonsmodules