Vipul
Vipul

Reputation: 576

Create a file object or Blob

How can we create a file object or a blob object in Node js? The object required should be same as we get while uploading a file from a form in HTML.

Upvotes: 13

Views: 8822

Answers (1)

T.J. Crowder
T.J. Crowder

Reputation: 1075567

You can't directly create objects from the File API, because that's an API designed for the client side and implemented by browsers.

If you wanted to, you could implement those same objects yourself (the API is fully documented, of course), but it would probably make more sense to use NodeJS's file system API instead.

Upvotes: 3

Related Questions