Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shudingbo #86

Open
shudingbo opened this issue Sep 20, 2024 · 1 comment
Open

shudingbo #86

shudingbo opened this issue Sep 20, 2024 · 1 comment

Comments

@shudingbo
Copy link

error: Module.open is not a function
version: 0.7.8
env: esm

let f = new h5wasm.File(this._fileName, 'r')  // error: Module.open is not a function 

Temporary solution:

Change the file hdf5'hl.js generated by packaging

export class File extends Group {
    constructor(filename, mode = "r", track_order = false) {
        let file_id;  //<< restore
        const access_mode = ACCESS_MODES[mode];
        const h5_mode = Module[access_mode];
        //const file_id = Module.open(filename, h5_mode, track_order);
          //<< restore
        if (['H5F_ACC_TRUNC', 'H5F_ACC_EXCL'].includes(access_mode)) {
            file_id = Module.ccall("H5Fcreate", "bigint", ["string", "number", "bigint", "bigint"], [filename, h5_mode, 0n, 0n]);
        }
        else {
            // then it is an existing file...
            file_id = Module.ccall("H5Fopen", "bigint", ["string", "number", "bigint"], [filename, h5_mode, 0n]);
        }
      // >>
        super(file_id, "/");
        this.filename = filename;
        this.mode = mode;
    }
``
@bmaranville
Copy link
Member

Can you tell me more about how you encountered the error? Was it in the browser, in a bundled application, etc?

When I import h5wasm from https://cdn.jsdelivr.net/npm/[email protected]/dist/esm/hdf5_hl.js in a browser, I am able to open files so I am not sure how to reproduce the error.

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

No branches or pull requests

2 participants