Skip to content

Javascript library to create or read tar files in the browser

License

Notifications You must be signed in to change notification settings

ankitrohatgi/tarballjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tarballjs

Javascript library to create or read tar files in the browser

Why?

It is often necessary to pack data into single files in the browser (e.g. creating a "project" file consisting of images+data in WebPlotDigitizer). One way is to create simple tarballs with all the data. There are a few existing libraries that do this, but this seems easy enough to do so I decided to do make my own library for learning purposes.

Status

Refer to https://www.npmjs.com/package/@gera2ld/tarjs for a better maintained version of this code. This code is mainly used to support WebPlotDigitizer.

There are a few known limitations with this library:

  • Browser only, no support for NodeJS.
  • File name (including path) has to be less than 100 characters.
  • Maximum total file size seems to be limited to somewhere between 500MB to 1GB (exact limit is unknown).

Some benefits of using this library:

  • Code is a lot cleaner than most other implementations that I can find.
  • Unit tests for read and write.

Browser Support

This works fine on any recent version of Chrome, Firefox or Safari.

Running Unit Tests

For Chrome, the test page has to be hosted on a HTTP server. An easy way is to use Python:

In the root directory of this project, do:

python3 -m http.server 8000

Then browse to http://localhost:8000/tests/

In Firefox, you can simply load tests/index.html without starting a web server.

Other Implementations

If you are aware of other implementations, then please let me know :)

References