Skip to content

Unable to Upload Buffer Media File (Type Errors) #514

Open
@jimburch

Description

@jimburch

I'm running wpapi in an express server and want to upload a Buffer from Express.Multer.File data. The docs say the file() method can accept a Buffer when added I get the error: Argument of type 'Buffer' is not assignable to parameter of type 'string | File'. Type 'Buffer' is missing the following properties from type 'File': lastModified, name, webkitRelativePath, size, and 4 more.ts(2345

Here is my setup:

image
image

I'm console logged buffer to make sure it is in fact a Buffer and I get buffer: <Buffer ff d8 ff e0 00 10 4a 46 49 46 00 01 01 00 00 01 00 01 00 00 ff db 00 43 00 03 02 02 03 02 02 03 03 03 03 04 03 03 04 05 08 05 05 04 04 05 0a 07 07 06 ... 70963 more bytes>,

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