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

feat: support base64 strings in InputFile #705

Open
Tracked by #675
KnorpelSenf opened this issue Dec 15, 2024 · 3 comments
Open
Tracked by #675

feat: support base64 strings in InputFile #705

KnorpelSenf opened this issue Dec 15, 2024 · 3 comments
Assignees

Comments

@KnorpelSenf
Copy link
Member

Title says it all. Should just be new InputFile({ base64 }).

@KnorpelSenf KnorpelSenf mentioned this issue Dec 15, 2024
51 tasks
@wojpawlik
Copy link
Contributor

👎: tc39/proposal-arraybuffer-base64#51

Why doesn't fetchFile check response.ok?

Next time I touch InputFile, I'd love to drop

  • Deno-only Deno.FsFile -- no advantage over new InputFile(fsFile.readable)
  • URLLike -- has to parse and construct URL each time:
    if ("url" in data) return await fetchFile(new URL(data.url));

@KnorpelSenf
Copy link
Member Author

KnorpelSenf commented Dec 18, 2024

👎: tc39/proposal-arraybuffer-base64#51

Epic stuff, I expect it to land in Deno in a few weeks which is early enough for us to use it

Why doesn't fetchFile check response.ok?

It should from now on.

Next time I touch InputFile, I'd love to drop

  • Deno-only Deno.FsFile -- no advantage over new InputFile(fsFile.readable)

The advantage is that users don't have to think about how to convert a Deno.FsFile to something grammY understands. We can do this work for them.

It does not have to do that, you just chose to do it. We can still change it.

@wojpawlik
Copy link
Contributor

wojpawlik commented Dec 18, 2024

{ base64 } (and URLLike) has to be parsed only once, in a conversion function called from the constructor.

Deno.FsFile stays for now. It might need to be replaced with { readable: AsyncIterable<Uint8Array> }. It could also be handled in the conversion function.

What are non-goals for InputFile? What should it not accept?

@wojpawlik wojpawlik self-assigned this Dec 21, 2024
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

No branches or pull requests

2 participants