Skip to content

Repository files navigation

ZenFS Archive Backends

ZenFS backends for archive files.

This packages adds some backends that allow you to create readonly file systems:

  • Zip for .zip files (PK Zip).
  • Iso for .iso files (ISO 9660).
  • Tar for .tar files. The POSIX/USTAR format is the most compatible, but gnu/oldgnu format tar files are also supported.

For more information, see the API documentation.

Please read the ZenFS core documentation!

Installation

Important

This project is licensed under the LGPL (v3+).

npm install @zenfs/archives

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: await res.bytes() },
	},
});

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.

Tar

Same as the Iso backend, you pass in the file data as a Uint8Array.

About

ZenFS backends for archive files

Topics

Resources

Contributing

Security policy

Stars

12 stars

Watchers

3 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages