@zenfs/zip
TypeScript icon, indicating that this package has built-in type declarations

0.4.5 • Public • Published

ZenFS Zip Backend

ZenFS backend for Zip files.

Please read the ZenFS documentation!

Backend

This package adds the Zip backend, which allows you to create a readonly file system from a zip file.

For more information, see the API documentation.

Usage

[!NOTE] The examples are written in ESM.
For CJS, you can require the package.
For a browser environment without support for type=module in script tags, you can add a script tag to your HTML pointing to the browser.min.js and use the global ZenFS_ZIP object.

You can't use Zip on its own. You must import the core in order to use the backend.

import { configure, fs } from '@zenfs/core';
import { Zip } from '@zenfs/zip';

const res = await fetch('http://example.com/archive.zip');

await configure({
	mounts: {
		'/mnt/zip': { backend: Zip, data: await res.arrayBuffer() },
	},
});

const contents = fs.readFileSync('/mnt/zip/in-archive.txt', 'utf-8');
console.log(contents);

Readme

Keywords

Package Sidebar

Install

npm i @zenfs/zip

Weekly Downloads

81

Version

0.4.5

License

MIT

Unpacked Size

362 kB

Total Files

35

Last publish

Collaborators

  • dr-vortex