Skip to content

Commit

Permalink
feat: Migrate to zarrita in Python bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
manzt committed Jul 19, 2024
1 parent 5c6d5b6 commit ee574c6
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions python/src/vizarr/_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,18 @@ function get_source(model, source) {
return {
/**
* @param {string} key
* @return {Promise<ArrayBuffer>}
* @return {Promise<Uint8Array | undefined>}
*/
async getItem(key) {
async get(key) {
const { data, buffers } = await send(model, {
type: "get",
source_id: source.id,
key,
});
if (!data.success) {
throw { __zarr__: "KeyError" };
return undefined;
}
return buffers[0].buffer;
},
/**
* @param {string} key
* @return {Promise<boolean>}
*/
async containsItem(key) {
const { data } = await send(model, {
type: "has",
source_id: source.id,
key,
});
return data;
return new Uint8Array(buffers[0].buffer);
},
};
}
Expand Down

0 comments on commit ee574c6

Please sign in to comment.