@andrewbranch/untar.js
untar salvaged from bitjs
Last updated 4 months ago by andrewbranch .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @andrewbranch/untar.js 
SYNC missed versions from official npm registry.

untar.js

Here's a simple pure-javascript implementation of untar (it's mostly taken verbatim from Jeff Schiller's bitjs, but no longer in a webworker— though ironically I'm making this in order to stick it back in a webworker, but I digress).

Here's a basic usage, it seems to work alright.

var untar = require('untar.js');
var fs = require('fs');

var file = fs.readFileSync(__dirname + '/' + 'test.tar');
untar.untar(file).forEach(function(file){
    console.log(file.filename, file.fileData.length);
})

It's also possible to combine this with pako in order to decode tarballs

var untar = require('untar.js')
var pako = require('pako')
var fs = require('fs')

var unzipped = pako.inflate(fs.readFileSync(__dirname + '/' + 'with-5.0.0.tgz'));

untar.untar(unzipped).map(function(file){
	console.log(file.filename)
})

It's pretty minimal as far as APIs go, it exposes a single method untar which can be passed an ArrayBuffer. It returns a list of TarLocalFile objects. The important fields are size, filename, and fileData.

Changelog

  • 0.2.3 — Fixing #2, thanks @jedie!
  • 0.2.2 — Fixing more decode bugs
  • 0.2.0 — Fixed a pretty major bug which led to decode errors from rounding to the wrong block.
  • 0.1.0 — Initial Release

Current Tags

  • 1.0.4                                ...           latest (4 months ago)

5 Versions

  • 1.0.4                                ...           4 months ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Total 8
Today 0
This Week 0
This Month 8
Last Day 0
Last Week 5
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE