jpalumickas / uplo

Handle file uploads to different storage services like Amazon S3, Google Cloud or etc. It also supports different type of ORM adapters, like Prisma.

Home Page:https://uplo.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[@uplo/service-gcs] Uint8Array not implemented but looks supported ?

iRyusa opened this issue · comments

Hi !

I don't know if i'm doing something wrong but in Bun I do :

await uplo.attachments.user(user.id).avatar.attachFile({
            fileName: file.name,
            content: Buffer.from(await file.arrayBuffer()),
            contentType: file.type
          })

The problem is:
Buffer.from(await file.arrayBuffer()) instanceof Uint8Array returns true

So it throws because of this:

} else if (content instanceof Uint8Array) {
  throw new Error("Uint8Array not implemented");
}

If I comment it, the file is uploaded properly tho, is there any reason you can't send a Buffer to GCS ?

Hey!

Good question, last time I checked, GCS was not supported Unit8Array, but yea, we can try to impement this or just remove this line.

Do you want a PR for this ? I'm trying to avoid fork+publish it possible 😅