Skip to content

Commit

Permalink
Merge pull request #4 from nika-begiashvili/single-file-extract
Browse files Browse the repository at this point in the history
Single file extract
  • Loading branch information
nika-begiashvili authored Mar 16, 2019
2 parents 78b4b3c + 24e3f57 commit 0220591
Show file tree
Hide file tree
Showing 11 changed files with 2,416 additions and 2,496 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ To get file listing without actually decompressing archive, use one of these met
await archive.getFilesObject();
// outputs
{
".gitignore": null,
".gitignore": {CompressedFile},
"addon": {
"addon.py": null,
"addon.xml": null
"addon.py": {CompressedFile},
"addon.xml": {CompressedFile}
},
"README.md": null
"README.md": {CompressedFile}
}

await archive.getFilesArray();
Expand All @@ -89,6 +89,15 @@ decompression might take long for bigger files, to track each file as it gets ex
});
```

### Extract single file form archive

To extract single file from archive you can use `extract()` method on returned `CompressedFile`

```js
const filesObj = await archive.getFilesObject();
const file = await filesObj['.gitignore'].extract();
```

## How it works

Libarchivejs is port of popular [libarchive](https://github.com/libarchive/libarchive) C library to WASM. since WASM runs in current thread library uses WebWorkers for heavy lifting, ES Module (Archive class) is just a client for WebWorker, it's tiny and doesn't take up much space.
Expand Down
2 changes: 1 addition & 1 deletion dist/worker-bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0220591

Please sign in to comment.