-
Notifications
You must be signed in to change notification settings - Fork 27
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
feat: data helpers for downloaded bytes #219
Conversation
src/types/index.ts
Outdated
@@ -64,6 +64,12 @@ export interface FileData<T> extends FileHeaders { | |||
data: T | |||
} | |||
|
|||
export interface Data extends Uint8Array { | |||
text: () => string | |||
json: () => Record<string, any> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently using any
gives a warning and it seems that there is some space for improvements here regarding the typing. I could even imagine having an optional validator function passed in to provide a return type information and to ensure that the returned type is valid. It doesn't have to be in this PR, just something to keep in mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Closes #191
Once approved, I will create follow up PR to
bee-js-docs
changing the docs.