zen-fs / archives

ZenFS backends for archive files
https://zenfs.dev/archives/
MIT License
5 stars 4 forks source link
zenfs

ZenFS Archive Backends

ZenFS backends for archive files.

This packages adds a few backends:

For more information, see the API documentation.

[!IMPORTANT] 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);

Note

The Iso implementation uses information on the ISO9660/ECMA119 standards from: