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

Find a way to read blobs synchronously #1

Open
jcbhmr opened this issue Apr 21, 2023 · 7 comments
Open

Find a way to read blobs synchronously #1

jcbhmr opened this issue Apr 21, 2023 · 7 comments
Assignees
Labels
question Further information is requested
Milestone

Comments

@jcbhmr
Copy link
Member

jcbhmr commented Apr 21, 2023

No description provided.

@jcbhmr jcbhmr added the question Further information is requested label Apr 21, 2023
@jcbhmr jcbhmr added this to the v1 milestone Apr 21, 2023
@jcbhmr jcbhmr self-assigned this Apr 21, 2023
@jcbhmr
Copy link
Member Author

jcbhmr commented Apr 21, 2023

image

looks like the trick of expecting pull(cb) to run synchronously only works sometimes

image

@jcbhmr
Copy link
Member Author

jcbhmr commented Apr 21, 2023

so this doesn't work https://github.com/jcbhmr/fileapi/blob/3500f6071e6a438bb39661c2d997b9bcfa9d6cc3/src/readBlobAsArrayBufferSync.ts

instead, i guess we could use synckit and transfer it to a worker thread, wait for the result, then transfer back an arraybuffer, right?

@jcbhmr
Copy link
Member Author

jcbhmr commented Apr 21, 2023

turns out synckit doesn't support transferList: un-ts/synckit#131

instead, I guess the best bet is to fork it into @jcbhmr/synckit or something

@jcbhmr
Copy link
Member Author

jcbhmr commented Apr 21, 2023

@jcbhmr
Copy link
Member Author

jcbhmr commented Apr 22, 2023

ok so if i can get the transferring and serialization magic to work, this COULD work? unless... i don't want the blob to be completely serialized when it passes the worker-barrier, I just want the REF to be passed, not the data COPIED to the other worker... hmmm

@jcbhmr
Copy link
Member Author

jcbhmr commented Apr 22, 2023

looking at this it doesnt LOOK like the underlying bytes are copied
image

@JounQin
Copy link

JounQin commented May 3, 2023

turns out synckit doesn't support transferList: un-ts/synckit#131

instead, I guess the best bet is to fork it into @jcbhmr/synckit or something

Hi, I think if there's a good use case for it, a PR is better?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants