Create .tar file via Blob object.
import Tar from "./tar"
filenames = ["a.png"]
// source url to fetch
src = ["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAYAAABkW7XSAAAAAXNSR0IArs4c6QAABGJJREFUeF7t1AEJAAAMAsHZv/RyPNwSyDncOQIECEQEFskpJgECBM5geQICBDICBitTlaAECBgsP0CAQEbAYGWqEpQAAYPlBwgQyAgYrExVghIgYLD8AAECGQGDlalKUAIEDJYfIEAgI2CwMlUJSoCAwfIDBAhkBAxWpipBCRAwWH6AAIGMgMHKVCUoAQIGyw8QIJARMFiZqgQlQMBg+QECBDICBitTlaAECBgsP0CAQEbAYGWqEpQAgQdWMQCX4yW9owAAAABJRU5ErkJggg=="]
const tarBlob: Blob = await Tar.create(filenames, src)
More detailed example available on example/ directory.
npm run example
- Launch web server on
example/
. e.g.cd example/ && python -m http.server 8080
- Access http://localhost:8080
- The tar file which contains
test.txt
anda.npy
will be downloaded.
These codes are licensed under CC0.
http://creativecommons.org/publicdomain/zero/1.0/deed