-
Notifications
You must be signed in to change notification settings - Fork 26
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
[Feature] @journeyapps/powersync-attachments
library
#20
Conversation
@journeyapps/powersync-attachments
library@journeyapps/powersync-attachments
library
…-native-sdk into lib/attachments
…tachmentRecord` async
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.
LGTM - just noted some future improvements for the adapter APIs.
writeFile( | ||
fileURI: string, | ||
base64Data: string, | ||
options?: { encoding?: EncodingType } | ||
): Promise<void>; |
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.
For a future version, it may be better to just take an ArrayBuffer (or Uint8Array) as parameter, and do the base64 encoding in the adapter implementation.
Also, not directly relevant here, but the demo implementation defaults to UTF8 decoding, despite the parameter being called base64Data
.
readFile( | ||
fileURI: string, | ||
options?: { encoding?: EncodingType; mediaType?: string } | ||
): Promise<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.
Is encoding relevant when an ArrayBuffer is returned either way?
Base64 = "base64", | ||
} | ||
|
||
export interface StorageAdapter { |
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.
It would help to have documentation for the methods and parameters here - especially the difference between file URI and path.
PowerSync library to manage attachments in TypeScript and React Native apps