L
L
lavezzi12019-07-19 10:48:52
JavaScript
lavezzi1, 2019-07-19 10:48:52

Is there an equivalent to new File() in nodejs?

I need to send a link to the image to my backend, get this image, convert it to File (as in js in the browser) and then send it to s3. This is how I get a picture as a blob in nodejs:

const url = 'https://someurl.com/images/5745rt.png';

const blob = await fetch(url)
            .then(response => response.blob())
            .then(response => response);

const file = new File([blob], fileName); // error

Next, I try to create a File object, but this thing is not implemented in nodejs, as far as I know. How to be?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question