Skip to content

Latest commit

 

History

History
54 lines (36 loc) · 1.38 KB

readme.md

File metadata and controls

54 lines (36 loc) · 1.38 KB

ZenFS Archive Backends

ZenFS backends for archive files.

This packages adds a few backends:

  • Zip allows you to create a readonly file system from a zip file.
  • Iso allows you to create a readonly file system from a .iso file.

For more information, see the API documentation.

Please read the ZenFS core documentation!

Usage

The easiest way to get started is by looking at these examples

Zip

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

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);

Iso

import { configure, fs } from '@zenfs/core';
import { Iso } from '@zenfs/archives';

const res = await fetch('http://example.com/image.iso');

await configure({
	mounts: {
		'/mnt/iso': { backend: Iso, data: new Uint8Array(await res.arrayBuffer()) },
	},
});

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

The Iso implementation uses information from the OS Dev Wiki and ECMA 119.