# tar-js

> Tar implemented in the browser

Latest version **0.3.0** (published 2012-05-05) · 0 weekly downloads

## Install

```sh
npm install tar-js
pnpm add tar-js
yarn add tar-js
bun add tar-js
```

## Health

**Score 18/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2012-05-05 |
| First published | 2011-06-04 |
| Weekly downloads | 0 |
| TypeScript types | separate (@types/tar-js) |
| Module format | CommonJS |
| Node | * |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 90 |
| Author | T. Jameson Little |
| Maintainers | beatgammit |
| Keywords | tar, browser, client, offline |

## Links

- npm: https://www.npmjs.com/package/tar-js
- Repository: https://github.com/beatgammit/tar-js
- Homepage: http://github.com/beatgammit/tar-js
- npm.io page: https://npm.io/package/tar-js

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2012-05-05
- 0.2.0 — 2011-10-29
- 0.1.1 — 2011-08-01
- 0.1.0 — 2011-06-04

## README

Intro
=====

Have you ever wanted to tar something, but you didn't want to push it to your server first?

Tar-js is here to the rescue!!

With tar-js, you can construct a tar archive in the browser. This is basically a port of tar-async for Nodejs for the browser, with a couple differences.

Here's what it supports:
  * Add strings to a tar archive as files
  * Customizable uid, gid, mtime, and permissions (defaults work well though too)
  * Add files in a directory heirarchy

Dependencies
------------

Tar needs an HTML5 compliant browser. More specifically it needs `Uint8Array` to work.

The examples depend on pakmanager, a package manager for the browser to make code written for node run in the browser.  Install it as such:

`pakmanager build`

Usage Guide
===========

The easiest way to interface with it is by using pakmanager. Include the package from pakmanager in your html, and then in you javascript:

    var Tar = require('tar'),
        tape = new Tar();

Then all you got to do is call `tape.append` with your params and it'll be added to the archive. That's it!

Here's the api for append: `append(filepath, content, [opts], [callback])`

* filepath- string path (can include directories and such)
* content- string or Uint8Array
* opts- options:
  * mode- permissions of resulting file (octet) [default: 777]
  * mtime- modification time in seconds (integer) [default: current time]
  * uid- user id (integer) [default: 0]
  * gid- group id (integer) [default: 0]
* callback- callback when done (takes a Uint8Array as it's only parameter)
  * This is a reference to the tar so far
  * Copy it if you want to use it, because subsequent adds may break stuff

---
_Source: https://npm.io/package/tar-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
