Skip to content

Commit

Permalink
Simplified examples
Browse files Browse the repository at this point in the history
  • Loading branch information
JrMasterModelBuilder committed Oct 1, 2023
1 parent 2396b92 commit b9b9453
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,10 @@ A plain directory can also be opened as an archive.
```js
import {ArchiveZip} from '@shockpkg/archive-files';

async function main() {
const archive = new ArchiveZip('path/to/archive.zip');
await archive.read(async entry => {
console.log(entry.path);
await entry.extract(`extracted/${entry.path}`);
});
}
main().catch(err => {
process.exitCode = 1;
console.error(err);
const archive = new ArchiveZip('path/to/archive.zip');
await archive.read(async entry => {
console.log(entry.path);
await entry.extract(`extracted/${entry.path}`);
});
```

Expand All @@ -53,16 +47,10 @@ main().catch(err => {
```js
import {createArchiveByFileExtension} from '@shockpkg/archive-files';

async function main() {
const archive = createArchiveByFileExtension('path/to/archive.zip');
await archive.read(async entry => {
console.log(entry.path);
await entry.extract(`extracted/${entry.path}`);
});
}
main().catch(err => {
process.exitCode = 1;
console.error(err);
const archive = createArchiveByFileExtension('path/to/archive.zip');
await archive.read(async entry => {
console.log(entry.path);
await entry.extract(`extracted/${entry.path}`);
});
```

Expand Down

0 comments on commit b9b9453

Please sign in to comment.