-
Notifications
You must be signed in to change notification settings - Fork 1
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
RS-394: Add query support for browser #90
Conversation
src/Record.ts
Outdated
@@ -12,7 +13,7 @@ export class ReadableRecord { | |||
public readonly time: bigint; | |||
public readonly size: bigint; | |||
public readonly last: boolean; | |||
public readonly stream: Stream; | |||
public readonly stream: Stream | ArrayBuffer; |
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.
I think you break the compatibility here, because in the client code the TS compiler will rise an error to force type check.
I think it is better to use two fields. We can even make it private.
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.
@atimin good point! I have added another private field for ArrayBuffer. The twist is to give a dummy stream to the stream field in the browser to avoid having an optional stream field that would break compatibility. Let me know if the new update makes sense.
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.
Perfect!
Closes #
Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
Bug fix
What was changed?
Related issues
No
Does this PR introduce a breaking change?
No
Other information:
Because the read function gives a Node.js Buffer object, applications running in the browser must install stream-browserify.