zip-rs-wasm/test.ts
Erica Marigold 473b156e1f
Some checks are pending
CI / Build and test : macOS-latest, msrv (push) Waiting to run
CI / Build and test : macOS-latest, nightly (push) Waiting to run
CI / Build and test : macOS-latest, stable (push) Waiting to run
CI / Build and test : ubuntu-latest, msrv (push) Waiting to run
CI / Build and test : ubuntu-latest, nightly (push) Waiting to run
CI / Build and test : ubuntu-latest, stable (push) Waiting to run
CI / Build and test : windows-latest, msrv (push) Waiting to run
CI / Build and test : windows-latest, nightly (push) Waiting to run
CI / Build and test : windows-latest, stable (push) Waiting to run
CI / Build and test --all-features: macOS-latest, msrv (push) Waiting to run
CI / Build and test --all-features: macOS-latest, nightly (push) Waiting to run
CI / Build and test --all-features: macOS-latest, stable (push) Waiting to run
CI / Build and test --all-features: ubuntu-latest, msrv (push) Waiting to run
CI / Build and test --all-features: ubuntu-latest, nightly (push) Waiting to run
CI / Build and test --all-features: ubuntu-latest, stable (push) Waiting to run
CI / Build and test --all-features: windows-latest, msrv (push) Waiting to run
CI / Build and test --all-features: windows-latest, nightly (push) Waiting to run
CI / Build and test --all-features: windows-latest, stable (push) Waiting to run
CI / Build and test --no-default-features: macOS-latest, msrv (push) Waiting to run
CI / Build and test --no-default-features: macOS-latest, nightly (push) Waiting to run
CI / Build and test --no-default-features: macOS-latest, stable (push) Waiting to run
CI / Build and test --no-default-features: ubuntu-latest, msrv (push) Waiting to run
CI / Build and test --no-default-features: ubuntu-latest, nightly (push) Waiting to run
CI / Build and test --no-default-features: ubuntu-latest, stable (push) Waiting to run
CI / Build and test --no-default-features: windows-latest, msrv (push) Waiting to run
CI / Build and test --no-default-features: windows-latest, nightly (push) Waiting to run
CI / Build and test --no-default-features: windows-latest, stable (push) Waiting to run
CI / cargo_fmt (push) Waiting to run
CI / check_minimal_versions (push) Waiting to run
CI / style_and_docs () (push) Waiting to run
CI / style_and_docs (--all-features) (push) Waiting to run
CI / style_and_docs (--no-default-features) (push) Waiting to run
CI / fuzz_read (push) Blocked by required conditions
CI / fuzz_read_with_no_features (push) Blocked by required conditions
CI / fuzz_write (push) Blocked by required conditions
CI / fuzz_write_with_no_features (push) Blocked by required conditions
DevSkim / DevSkim (push) Waiting to run
Release / Release-plz (push) Waiting to run
feat: add wasm bindings
2024-12-26 15:22:35 +00:00

19 lines
614 B
TypeScript

import * as path from "jsr:@std/path";
import { ensureDir } from "jsr:@std/fs";
import { unzip } from "./pkg/zip.js";
const EXTRACTED_DIR = "./extracted";
await ensureDir(EXTRACTED_DIR);
const TARGET_PATH = Deno.args[0];
if (!TARGET_PATH) {
console.error("usage: test.js <path>");
Deno.exit(1);
}
const zipFile = Deno.readFileSync(TARGET_PATH);
for (const [file, contents] of Object.entries(unzip([...zipFile]))) {
// TODO: handle directories & more in the future
const contentBytes = new TextEncoder().encode(contents);
Deno.writeFileSync(path.join(EXTRACTED_DIR, file), contentBytes);
}