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

feat: data helpers for downloaded bytes #219

Merged
merged 4 commits into from
Mar 19, 2021
Merged

feat: data helpers for downloaded bytes #219

merged 4 commits into from
Mar 19, 2021

Conversation

AuHau
Copy link
Contributor

@AuHau AuHau commented Mar 19, 2021

Closes #191

Once approved, I will create follow up PR to bee-js-docs changing the docs.

@@ -64,6 +64,12 @@ export interface FileData<T> extends FileHeaders {
data: T
}

export interface Data extends Uint8Array {
text: () => string
json: () => Record<string, any>
Copy link
Member

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.

src/utils/bytes.ts Outdated Show resolved Hide resolved
Copy link
Member

@agazso agazso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@AuHau AuHau changed the title feat: data helpers for bytes feat: data helpers for downloaded bytes Mar 19, 2021
@AuHau AuHau merged commit 3af3826 into master Mar 19, 2021
@AuHau AuHau deleted the feat/data-helper branch March 19, 2021 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return data type for download functions
2 participants