Read & Generate Tar Files In The Browser – tarball.js

Category: Javascript | June 17, 2022
Author:ankitrohatgi
Views Total:0 views
Official Page:Go to website
Last Update:June 17, 2022
License:MIT

Preview:

Read & Generate Tar Files In The Browser – tarball.js

Description:

Tar is a commonly used file format on Linux and other UNIX systems. It has been the de facto standard used to aggregate files and folders into one single archive since 1979. Tar files typically use the filename extensions “.tar” or “.tgz”.

tarball.js is a JavaScript library that makes it easy to read and generate tar files in the browser without a server environment like Node.js.

How to use it:

1. Download and import the tarball.js library.

<script src="tarball.js"></script>

2. Read data from a tar file.

tar.readFile(tarFile).then(function(fileInfo) {
  // ...
}, function(err) {
  // ...
});

3. Generate a tar from files.

tar.addFile(name, text, opts);

4. Download the tar file.

tar.download("tarball.tar");

You Might Be Interested In:


Leave a Reply