8000 feat: `File` support in `InputFile` · Issue #725 · grammyjs/grammY · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
feat: File support in InputFile #725
Closed
@wojpawlik

Description

@wojpawlik

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0