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: File support in InputFile #725

Closed
Tracked by #675
wojpawlik opened this issue Dec 16, 2024 · 2 comments
Closed
Tracked by #675

feat: File support in InputFile #725

wojpawlik opened this issue Dec 16, 2024 · 2 comments

Comments

@wojpawlik
Copy link
Contributor

Related: #675

Easy: if (file instanceof File) return file.name in guessFilename().

Bonus: change

export class InputFile {
  public readonly filename?: string;
  async toRaw(): Promise<
    Uint8Array | Iterable<Uint8Array> | AsyncIterable<Uint8Array>
  >
}

to

export class InputFile {
  readonly name?: string;
  async stream(): AsyncIterable<Uint8Array>;
}

This would:

  • align with web standards,
  • simplify file handling in Client,
  • increase flexibility: new InputFile(inputFile, "new name"),
  • give us the option to add a [Symbol.hasInstance]() accepting BunFile, and InputFile from other grammY versions.
@KnorpelSenf KnorpelSenf changed the title File support feat: File support in InputFile Dec 16, 2024
@KnorpelSenf KnorpelSenf mentioned this issue Dec 16, 2024
51 tasks
@KnorpelSenf
Copy link
Member

@all-contributors add @wojpawlik for code

Copy link
Contributor

@KnorpelSenf

I've put up a pull request to add @wojpawlik! 🎉

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