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

[Feature] @journeyapps/powersync-attachments library #20

Merged
merged 11 commits into from
Nov 2, 2023

Conversation

Manrich121
Copy link
Contributor

@Manrich121 Manrich121 commented Oct 31, 2023

PowerSync library to manage attachments in TypeScript and React Native apps

@Manrich121 Manrich121 changed the title [feature] @journeyapps/powersync-attachments library [Feature] @journeyapps/powersync-attachments library Oct 31, 2023
@Manrich121 Manrich121 marked this pull request as ready for review November 1, 2023 12:54
stevensJourney
stevensJourney previously approved these changes Nov 2, 2023
Copy link
Contributor

@rkistner rkistner left a 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.

Comment on lines +15 to +19
writeFile(
fileURI: string,
base64Data: string,
options?: { encoding?: EncodingType }
): Promise<void>;
Copy link
Contributor

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.

Comment on lines +21 to +24
readFile(
fileURI: string,
options?: { encoding?: EncodingType; mediaType?: string }
): Promise<ArrayBuffer>;
Copy link
Contributor

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 {
Copy link
Contributor

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.

@Manrich121 Manrich121 merged commit 0c94548 into main Nov 2, 2023
1 check passed
@Manrich121 Manrich121 deleted the lib/attachments branch November 2, 2023 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants