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!
This project is licensed under the LGPL (v3+).
npm install @zenfs/archives
The easiest way to get started is by looking at these examples
Zipimport { 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);
Isoimport { 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.
TarSame as the Iso backend, you pass in the file data as a Uint8Array.