Skip to content

Comments

Add libver bounds argument(s) when opening files#122

Merged
bmaranville merged 12 commits intomainfrom
add-libver
Feb 19, 2026
Merged

Add libver bounds argument(s) when opening files#122
bmaranville merged 12 commits intomainfrom
add-libver

Conversation

@bmaranville
Copy link
Member

libver bounds support

added HDF5 library version bounds control to h5wasm, matching h5py's API.

API Changes

File Constructor

new File(filename, mode, track_order, libver)
  • libver: "earliest" | "v108" | "v110" | "v112" | "v114" | "v200" | "latest" or [low, high] tuple

File.libver Property

file.libver // Returns: [LIBVER_BOUND, LIBVER_BOUND]

Constants

LIBVER_BOUNDS_MAP = {
  "earliest": "H5F_LIBVER_EARLIEST",
  "v108": "H5F_LIBVER_V18",      // HDF5 1.8 format
  "v110": "H5F_LIBVER_V110",     // HDF5 1.10 (SWMR compatible)
  "v112": "H5F_LIBVER_V112",
  "v114": "H5F_LIBVER_V114",
  "v200": "H5F_LIBVER_V200",     // HDF5 2.0
  "latest": "H5F_LIBVER_LATEST"
}

SWMR fixes

While working on libver implementation, also fixed the SWMR writing implementation. Reading in SWMR mode was already working, but writing was broken.

Open for SWMR write:

  // Create file with SWMR-compatible format (v110 minimum)
  const f_create = new h5wasm.File(FILEPATH, "w", false, "v110");

  // Create an extensible chunked dataset (required for SWMR)
  f_create.create_dataset({
    name: "data",
    data: INITIAL_DATA,
    maxshape: [null],
    chunks: [10]
  });
  f_create.flush();
  f_create.close();

  // Open for SWMR write
  const f_write = new h5wasm.File(FILEPATH, "Sw");
  // ... resize datasets and append data, etc.

@bmaranville
Copy link
Member Author

Note: addresses #119

@bmaranville
Copy link
Member Author

I think instead of adding more positional arguments, creating an 'options' argument object like was proposed in #119 is a good idea. It will be a breaking change for anyone that was already using the track_order positional argument, but if we add more options in the future it will help keep things organized.

@bmaranville
Copy link
Member Author

I preserved the original File constructor signature, but deprecated it with a JSDoc comment (so TS developers will see it is deprecated).

New libver option is only available through using the new FileOptions argument to constructor. See new README for details.

@bmaranville bmaranville requested a review from axelboc February 18, 2026 20:55
Copy link
Collaborator

@axelboc axelboc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Impressive! Good call on the options object and deprecating the previous constructor signature 💯

@bmaranville bmaranville merged commit ac72edf into main Feb 19, 2026
2 checks passed
@bmaranville bmaranville deleted the add-libver branch February 19, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants