Skip to content

Releases: zen-fs/archives

1.3.6

Choose a tag to compare

@james-pre james-pre released this 03 Apr 16:30
v1.3.6
e9a653d

This patch updates utilium to 3.0.

1.3.5

Choose a tag to compare

@james-pre james-pre released this 02 Apr 19:19
v1.3.5
0c72c79

This patch updates to typescript 6.0.

1.3.4

Choose a tag to compare

@james-pre james-pre released this 28 Mar 04:05
v1.3.4
aa70695

Added ZipFlags enum and setters for lastModified.

1.3.3

Choose a tag to compare

@james-pre james-pre released this 28 Mar 03:49
v1.3.3
b975f47
  • Renamed msdosDate to fromMsdosDate
  • Added toMsdosDate, compress, compressionMethods

1.3.2

Choose a tag to compare

@james-pre james-pre released this 28 Mar 03:39
v1.3.2
a9e3545
  • Changed some zip structs to use memium v0.4's isDynamic
  • Added ZipDataSource.isShared
  • Added isShared and getDynamic [internal]
  • Updated @types/node requirement (24 -> 25)
  • Made iso tests stricter
  • Updated memium and utilium
  • Updated eslint config and .gitignore
  • Added license exception for bundling in web apps (#18, thanks @jlarmstrongiv)
  • Updated workflows for OIDC publishing

1.3.1

Choose a tag to compare

@james-pre james-pre released this 15 Oct 21:35
v1.3.1
eac2ec1
  • 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

Choose a tag to compare

@james-pre james-pre released this 17 Sep 02:16
v1.3.0
fbd1638

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

Choose a tag to compare

@james-pre james-pre released this 01 Sep 15:33
v1.2.5
8904248
  • Re-licensed under the LGPL
  • Updated dependencies, including @zenfs/core

1.2.4

Choose a tag to compare

@james-pre james-pre released this 02 Aug 17:28
v1.2.4
0c79718

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

1.2.3

Choose a tag to compare

@james-pre james-pre released this 04 Jul 05:25
v1.2.3
d609257

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