Skip to content

Releases: zen-fs/archives

1.3.1

15 Oct 21:35
v1.3.1
eac2ec1

Choose a tag to compare

  • Fixed some imports from @zenfs/core using internal paths instead of public ones
  • Updated @zenfs/core
  • Removed unused imports
  • Made tests more readable

1.3.0

17 Sep 02:16
v1.3.0
fbd1638

Choose a tag to compare

This release makes some improvements to the Zip backend's internals.

Position independent substructures

Many of the classes that represent binary structures have been rewritten so that the dynamically sized data is fetched independently of the byteOffset of the class/structure instance. This should make the backend more resistant to byteOffset weirdness (like Buffers almost always having a different byteOffset from the position in a file). This is also a requirement for the next feature:

Custom Data Sources

The data option of ZipOptions now accepts a new interface, ZipDataSource, that allows you to specify an arbitrary function for fetching data. This can be used to lazily get data only when it is needed, or to work with APIs that don't allow retriving all of the data at once.

The simplified interface is:

interface ZipDataSource {
	size: number;
	get(offset: number, length: number): Uint8Array | Promise<Uint8Array>;
}

A good example of this is lazily reading from a file on Node.js:

const fd = openSync('your-archive.zip', 'r');
const { size } = fstatSync(fd);

await configureSingle({
	backend: Zip,
	data: {
		size,
		get(offset, length) {
			const data = new Uint8Array(length);
			const read = readSync(fd, data, { position: offset, length });
			return data;
		},
	},
});

Streams (#3)

It is now possible to stream a zip file by configuring data as fromStream(readableStream, sizeInBytes). In general this probably isn't super useful since streams will go from front to back, while zip files' metadata is at the very end.

Lazy mode

lazy was added to ZipOptions a year ago, but unfortunately wasn't implemented until now.

When you enable lazy, file contents will not be preloaded during configuration. This means you can't synchronously read until after having either performed an asynchronous read or waited long enough after a failed synchronous read that threw EAGAIN.

What that looks like in practice:

fs.readFileSync('/archive/xyz') // throws EAGAIN

// In a different program...

await fs.promises.readFileSync('archive/xyz') // cached after this
fs.readFileSync('/archive/xyz') // all good!

A few things to note:

  • Reading any part of a file inside the zip archive will decompress that entire file
  • Metadata like file names and comments are not affected by lazy mode
  • After reading a file (including when sync. reads throw EAGAIN), the file contents are cached in memory (and available synchronously)

1.2.5

01 Sep 15:33
v1.2.5
8904248

Choose a tag to compare

  • Re-licensed under the LGPL
  • Updated dependencies, including @zenfs/core

1.2.4

02 Aug 17:28
v1.2.4
0c79718

Choose a tag to compare

This release updates various dependencies. Primarily, structs have been updated for use with Memium 0.3.8.

1.2.3

04 Jul 05:25
v1.2.3
d609257

Choose a tag to compare

This release adds missing struct names. See zen-fs/core#238 for more details.

1.2.2

13 Jun 21:52
v1.2.2
2332530

Choose a tag to compare

This release adds a temporary workaround for microsoft/TypeScript#61862.

1.2.1

13 Jun 20:59
v1.2.1
e9c8d14

Choose a tag to compare

1.2.0

22 Apr 06:36
v1.2.0
619a368

Choose a tag to compare

This release updates to @zenfs/core v2.1.0 and overhauls internals to work with Memium.

1.1.0

15 Mar 00:08
v1.1.0
6c07ed1

Choose a tag to compare

  • Updated to @zenfs/core 2.0
  • Iso now uses an ArrayBuffer and offset combination instead of Uint8Arrays
  • Renamed PrimaryOrSupplementaryVolumeDescriptor to PrimaryVolumeDescriptor
  • Fixed some arrays not being initialized in PrimaryVolumeDescriptor
  • Cleanup and the initialization of the primary volume descriptor
  • Fixed safeDecode
  • data renamed to contents for FileEntry
  • computeEOCD is no longer a method on ZipFS
  • A lot of other code cleanup
  • Fix typo in documentation

1.0.5

06 Feb 16:23
v1.0.5
3a2073c

Choose a tag to compare

  • Fixed types in packages.json (fixes #13) pointing to source
  • Fixed doc comment