Skip to content

Commit

Permalink
Fix parsing of committed datatypes metadata with h5wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
axelboc committed Aug 29, 2024
1 parent ac0b148 commit 1b3f8e1
Show file tree
Hide file tree
Showing 4 changed files with 377 additions and 53 deletions.
2 changes: 1 addition & 1 deletion packages/h5wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"dependencies": {
"comlink": "4.4.1",
"h5wasm": "0.7.6",
"h5wasm": "0.7.7",
"nanoid": "5.0.7"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/h5wasm/src/worker-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export function parseEntity(
}

if (kind === h5wasm.H5G_TYPE) {
const metadata = h5wasm.get_dataset_metadata(fileId, path);
const metadata = h5wasm.get_datatype_metadata(fileId, path);
const { chunks, maxshape, shape, ...rawType } = metadata; // keep `rawType` concise

return {
Expand Down
16 changes: 5 additions & 11 deletions packages/h5wasm/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ async function openFileBuffer(buffer: ArrayBuffer): Promise<bigint> {

FS.writeFile(fileName, new Uint8Array(buffer), { flags: 'w+' });

return h5wasm.ccall(
'H5Fopen',
'bigint',
['string', 'number', 'bigint'],
[fileName, h5wasm.H5F_ACC_RDONLY, 0n],
);
return h5wasm.open(fileName, h5wasm.H5F_ACC_RDONLY, false);
}

async function openLocalFile(file: File): Promise<bigint> {
Expand All @@ -41,11 +36,10 @@ async function openLocalFile(file: File): Promise<bigint> {
const { WORKERFS } = FS.filesystems;
WORKERFS.createNode(rootNode, fileName, WORKERFS.FILE_MODE, 0, file);

return h5wasm.ccall(
'H5Fopen',
'bigint',
['string', 'number', 'bigint'],
[`${WORKERFS_FOLDER}/${fileName}`, h5wasm.H5F_ACC_RDONLY, 0n],
return h5wasm.open(
`${WORKERFS_FOLDER}/${fileName}`,
h5wasm.H5F_ACC_RDONLY,
false,
);
}

Expand Down
Loading

0 comments on commit 1b3f8e1

Please sign in to comment.