class FS
extends ZipDirectoryEntry
import { FS } from "https://dotland.deno.dev/x/zipjs@v2.7.53/index.js";
Represents a Filesystem instance.
Examples
Here is an example showing how to create and read a zip file containing a compressed text file:
Here is an example showing how to create and read a zip file containing a compressed text file:
const TEXT_CONTENT = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.";
const FILENAME = "lorem.txt";
const BLOB = new Blob([TEXT_CONTENT], { type: zip.getMimeType(FILENAME) });
let zipFs = new zip.fs.FS();
zipFs.addBlob("lorem.txt", BLOB);
const zippedBlob = await zipFs.exportBlob();
zipFs = new zip.fs.FS();
await zipFs.importBlob(zippedBlob);
const firstEntry = zipFs.children[0];
const unzippedBlob = await firstEntry.getBlob(zip.getMimeType(firstEntry.name));
Methods
find(fullname: string): ZipEntry | undefined
Returns a {@link ZipEntry} instance from its full filename
getById(id: number): ZipEntry | undefined
Returns a {@link ZipEntry} instance from the value of {@link ZipEntry#id}
move(entry: ZipEntry, destination: ZipDirectoryEntry): void
Moves a {@link ZipEntry} instance and its children into a ZipDirectoryEntry instance