Reputation: 12449
I am using restify
. On POST
it gets a JSON object and store the values into database.
Now I need to upload image as well.
Scenario is: Upload image, re-size it to specified sizes(3 types of thumbnails) and save them all on server.
I don't want a complete code. I just need a head start, which npm
would be best for this scenario?
Upvotes: 2
Views: 1260
Reputation: 27247
Take a look at multer
and it's inMemory
option. Using this you can access the file within a restify
route handler, manipulate it in memory, and then return it to the client and/or write it to the filesystem after resizing.
There are a bunch of modules on npm that perform image resizing. For example, sharp
.
Upvotes: 1