class FS
extends ZipDirectoryEntry
import { FS } from "https://deno.land/x/zipjs@v2.6.77/index.d.ts";
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));
Properties
root: ZipDirectoryEntry
The root directory.
Methods
find(fullname: string): ZipEntry | undefined
Returns a ZipEntry instance from its full filename
getById(id: number): ZipEntry | undefined
Returns a ZipEntry instance from the value of ZipEntry#id
move(entry: ZipEntry, destination: ZipDirectoryEntry): void
Moves a ZipEntry instance and its children into a ZipDirectoryEntry instance
remove(entry: ZipEntry): void
Removes a ZipEntry instance and its children