From b9b9453cd5261f236a902193ede1174433114fe8 Mon Sep 17 00:00:00 2001 From: JrMasterModelBuilder Date: Sun, 1 Oct 2023 03:16:02 -0400 Subject: [PATCH] Simplified examples --- README.md | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index fd62854..4c9fbb8 100644 --- a/README.md +++ b/README.md @@ -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}`); }); ``` @@ -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}`); }); ```