-
Notifications
You must be signed in to change notification settings - Fork 18
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
Allow client-generated exports of datasets #1063
Comments
@bmaranville, with the next release, you will be able to pass a The |
Sounds like you've done all the hard stuff... I'll definitely share any progress I make. |
Something is wrong with the types being given for getExportURL, and the example pseudocode can't even work:
I am supplying a function signature as
EDIT: I think I got something to work, by converting Value to an Array. The type definitions in this project are very detailed and I struggle sometimes to figure them out even when the underlying code (logic) is clear. |
Hey, sorry, I wasn't expecting you to try it out before the release. 😆 It did occur to me after closing the issue that some of the types/assertions would probably need to be exported to make implementing the function more straightforward. I'll investigate and keep in touch. |
Alright, so with #1249, Now, there's still something that doesn't sit quite right with me: it's the fact that it's not possible to narrow down the type of the values contained inside the const getExportURL: GetExportURL = (format, dataset, selection, value) => async () => {
if (hasNumericType(dataset)) {
value.forEach(val => {
// I would expect `val` to be `number` here, but it remains `unknown`
})
}
}; For now, the only options are to write a type guard specifically for the // With a `value` array type guard
function isNumericArray(arr): arr is number[] | TypedArray {
return typeof arr[0] === 'number';
}
if (isNumericArray(value) {
value.forEach(val => { /* `val` is `number` */ });
}
// ... or if you know the provider always returns `TypedArray`
if (isTypedArra(value)) { ... }
// With an inline type guard to check each individual value
value.forEach(val => {
if (typeof val === 'number') { ... }
}); No idea if this problem is solvable or not at this point. |
FYI, in #1485 I'm adding client-side JSON-export capability to the h5wasm data provider. |
Is your feature request related to a problem?
Providers (e.g. h5wasm) that read the HDF5 file directly in the browser are unable to take advantage of server-side-generated exports of datasets or slices (URL-based)
Requested solution or feature
Allow client-generated exports to be included in the menu in addition to backend-supported URL endpoints e.g. (lazy: Function | URL: string) instead of just URL: string
Alternatives you've considered
Copying/pasting options discussed in #35 could be relevant, but exports would be nice.
Additional context
The numpy target format (.NPY) is exceptionally well-documented and would be very easy to implement client-side, as well as CSV/TSV for < 3 dims. TIFF is probably possible with a library for 2 dims.
The text was updated successfully, but these errors were encountered: