-
Notifications
You must be signed in to change notification settings - Fork 196
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
fix(loader-utils): ReadableFile implementation to match the interface #3157
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -30,8 +30,8 @@ export class HttpFile implements ReadableFile { | |||||||||
}; | ||||||||||
} | ||||||||||
|
||||||||||
async read(offset: number | bigint, length: number): Promise<ArrayBuffer> { | ||||||||||
const response = await this.fetchRange(offset, length); | ||||||||||
async read(offset?: number | bigint, length?: number): Promise<ArrayBuffer> { | ||||||||||
const response = await this.fetchRange(offset ?? 0, length ?? 0); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use default argument syntax for better clarity?
Suggested change
|
||||||||||
const arrayBuffer = await response.arrayBuffer(); | ||||||||||
return arrayBuffer; | ||||||||||
} | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ export class NodeFileFacade implements ReadableFile, WritableFile { | |
throw new Error('Can\'t instantiate NodeFile. Make sure to import @loaders.gl/polyfills first.'); | ||
} | ||
/** Read data */ | ||
async read(start?: number | bigint, end?: number | bigint): Promise<ArrayBuffer> { | ||
async read(start?: number | bigint, offset?: number): Promise<ArrayBuffer> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's my mistake, I'll change it to |
||
throw NOT_IMPLEMENTED; | ||
} | ||
/** Write to file. The number of bytes written will be returned */ | ||
|
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.
Why this change?
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 faced a problem when I have
ReadableFile
as input inFileProvider
and read() there acceptsstart
asnumber | bigint
so I pass bigint here and get runtime error that it cannot sum bigint and number because real implementation knows nothing about bigint. We need keep real implementation of the methods matching it's description inReadableFile