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

Adds dataAtPath method to API #46

Merged
merged 1 commit into from Mar 8, 2019
Merged

Adds dataAtPath method to API #46

merged 1 commit into from Mar 8, 2019

Conversation

andrewxhill
Copy link
Member

No description provided.

@andrewxhill andrewxhill merged commit 45f5513 into master Mar 8, 2019
@@ -2,6 +2,11 @@ import { NativeModules } from 'react-native'

const { TextileNode } = NativeModules

export async function dataAtPath(path: string): Promise<string> {
const result = await TextileNode.dataAtPath(path)
return result as string
Copy link
Member

Choose a reason for hiding this comment

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

Buffer (UIntArray) could be a better return type for "data".

Copy link
Member

Choose a reason for hiding this comment

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

Or is the string returned a data url?

Copy link
Member

Choose a reason for hiding this comment

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

The data could be anything at that path. So, no way to properly construct a data URL. It just returns a byte slice: func (m *Mobile) DataAtPath(pth string) ([]byte, error)

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. This should return Buffer or UIntArray then.

Copy link
Member Author

Choose a reason for hiding this comment

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

ah okay, i just got lucky in that the string could just be dropped into the rn image uri

Copy link
Member

Choose a reason for hiding this comment

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

Surprised that worked. Maybe RN Image has some default handling of string values that made it work.

@andrewxhill
Copy link
Member Author

yeah, data url

@sanderpick sanderpick deleted the andrew/1.1.0-rc34 branch March 29, 2019 19:49
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.

None yet

3 participants