2

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?

Shaharyar
  • 12,254
  • 4
  • 46
  • 66

1 Answers1

1

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.

sdgluck
  • 24,894
  • 8
  • 75
  • 90