uploadcare / uploadcare-js-api-clients

JavaScript library for work with Uploadcare API
https://uploadcare.com/docs/start/api/
MIT License
60 stars 14 forks source link

How to stream upload a file with node? #454

Open Amatewasu opened 1 year ago

Amatewasu commented 1 year ago

How to stream upload a file with Node.js?

Hi, first of all thank you for your library.

Here's a quote of the type of the uploadFile function:

 uploadFile(
    data: NodeFile | BrowserFile | Url | Uuid,
    options: FileFromOptions
  ): Promise<UploadcareFile>

If I have a large file on disk and don't want to load it in memory, how could I do that? Because in the example the file data is already in RAM but I would like to avoid that.

Thanks and have a great day!

nd0ut commented 1 year ago

Hey @Amatewasu,

Unfortunately, we don't support node streams yet.

Amatewasu commented 1 year ago

Thank you for your answer @nd0ut. I guess there is no way of uploading a file without fully loading it in RAM then?

nd0ut commented 1 year ago

Technically it's possible but isn't implemented in this library. You could use Upload API directly to upload files from the stream.