-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
48 lines (42 loc) · 1.25 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const js = import("./pkg");
js
.then(js => {
return js.N5HTTPFetch.open("http://localhost:8090")
})
.then(reader => {
return Promise.all([
reader.get_version()
.then(version => {
console.log(version.to_string());
}),
reader.exists("volume")
.then(exists => {
console.log("volume:" + exists);
}),
reader.dataset_exists("volume")
.then(exists => {
console.log("volume is dataset:" + exists);
}),
reader.exists("foobar")
.then(exists => {
console.log("foobar:" + exists);
}),
reader.list_attributes("volume")
.then(attrs => {
console.log(attrs);
}),
reader.get_dataset_attributes("volume")
.then(data_attrs => {
console.log("volume attributes:" + data_attrs.get_dimensions());
return reader.read_block("volume", data_attrs, [0, 0, 0].map(BigInt));
})
.then(block => {
console.log("block:" + (block == null));
console.log(block);
console.log(block.get_size());
console.log(block.get_grid_position());
console.log(block.get_data());
console.log(block.get_num_elements());
})
])
});