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

Write zarr array to remote HTTPStore #108

Open
oeway opened this issue Oct 7, 2021 · 1 comment
Open

Write zarr array to remote HTTPStore #108

oeway opened this issue Oct 7, 2021 · 1 comment

Comments

@oeway
Copy link
Contributor

oeway commented Oct 7, 2021

Hi, I am trying to use the HTTPStore to write zarr array to remote servers (where I implemented the PUT method), however I couldn't find any example for doing it for HTTPStore.

This is what I have so far:

        const fetchOptions = { redirect: 'follow', headers: { 'Authorization': `Bearer ${token}` } };
        const supportedMethods = ['GET', 'PUT', 'HEAD']; // defaults
        const store = new zarr.HTTPStore(`https://my-website.io/123/mydata.zarr`, { fetchOptions, supportedMethods });
        const z = await zarr.zeros([1000, 1000], {chunks: [100, 100], dtype: '<i4', store});
        await z.set(null, 42);
        await z.set([0, null], zarr.NestedArray.arange(1000, "<i4")); 
        await z.set([null, 0], zarr.NestedArray.arange(1000, "<i4")); 
        console.log(await z.get([0, 0]));

I tested with this, but it failed at "fetcing https://my-website.io/123/mydata.zarr/.zarray" (when calling containsItem), I tried to set overwrite: true, but it said not implemented yet.

@gzuidhof
Copy link
Owner

gzuidhof commented Oct 7, 2021

Hi Wei,

You can find the implementation here: https://github.com/gzuidhof/zarr.js/blob/master/src/storage/httpStore.ts#L58-L68. I wouldn't be surprised if you were one of the first to write to a remote server using the HTTPStore so it's a bit of an uncharted territory (without any examples).

What fetch errors are you seeing (in the Network tab in your browser)? Is it the webserver rejecting the message, or is it something internal to zarr/httpstore going wrong?

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