# @slimio/tarball

> SlimIO archive tarball packer/extractor

Latest version **0.1.0** (published 2019-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @slimio/tarball
pnpm add @slimio/tarball
yarn add @slimio/tarball
bun add @slimio/tarball
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2019-08-21 |
| First published | 2019-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 11.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | SlimIO |
| Maintainers | captainfive, fraxken, alexandre.malaj |
| Keywords | slimio, archive, bundler, pack, packer, tarball, extractor, extract |

## Links

- npm: https://www.npmjs.com/package/@slimio/tarball
- Repository: https://github.com/SlimIO/Tarball
- Homepage: https://github.com/SlimIO/Tarball#readme
- Issues: https://github.com/SlimIO/Tarball/issues
- npm.io page: https://npm.io/package/@slimio/tarball

## Dependencies (3)

- [uuid](https://npm.io/package/uuid.md) ^3.3.3
- [tar-fs](https://npm.io/package/tar-fs.md) ^2.0.0
- [premove](https://npm.io/package/premove.md) ^1.0.0

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 0.1.0 (latest) — 2019-08-21

## README

# Tarball
![version](https://img.shields.io/badge/version-0.1.0-blue.svg)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/SlimIO/is/commit-activity)
![MIT](https://img.shields.io/github/license/mashape/apistatus.svg)

SlimIO archive (for addons and modules) tarball packer/extractor.

## Requirements
- [Node.js](https://nodejs.org/en/) v10 or higher

## Getting Started

This package is available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).

```bash
$ npm i @slimio/tarball
# or
$ yarn add @slimio/tarball
```

## Usage example
```js
const { pack, extract } = require("@slimio/tarball");
const { resolve } = require("path");

async function main() {
    const archiveName = resolve("myArchive.tar");

    // Create .tar archive
    await pack(resolve("directory"), archiveName);

    // Extract .tar to the given directory
    await extract(archiveName, resolve("directoryBis"), {
        deleteTar: true
    });
}
main().catch(console.error);
```

## API

### pack(location: string, destination: string, options?: PackOptions): Promise< void >
Pack a location (that must be a directory) into a **tar** archive.

Options is described by the following interface:
```ts
interface PackOptions {
    include?: Set<string>;
}
```

Example that include only `index.js` & `slimio.toml`:
```js
await pack("./myAddon", "myAddon.tar", {
    include: new Set(["index.js", "slimio.toml"])
});
```

### extract(location: string, destination: string, options?: ExtractOptions): Promise< void >
Extract a **tar** archive to a given destination.

Options is described by the following interface:
```ts
interface ExtractOptions {
    deleteTar?: boolean;
    deleteDestinationOnFail?: boolean;
}
```

By default **deleteTar** and **deleteDestinationOnFail** are equal to **false**.

## Dependencies

|Name|Refactoring|Security Risk|Usage|
|---|---|---|---|
|[premove](https://github.com/lukeed/premove#readme)|Minor|Low|Recursive unlink/rmdir|
|[tar-fs](https://github.com/mafintosh/tar-fs)|Minor|High|Pack and extract .tar archive|
|[uuid](https://github.com/kelektiv/node-uuid#readme)|Minor|Low|Generate unique id for temporary filename|

## License
MIT

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