Search code examples
imagemagickfeathersjs

Add a hook to run a command line with FeathersJS


I'm using feathers-blob to upload images, and I wish to use imagemagick to create thumbnails of these pictures, via an after hook.

I already have the imagemagick command to create thumbnails. I was looking for some integration of Feathers with imagemagick, but there doesn't seem to be one.

So I thought I'd just run a plain command in the prompt to create the thumbnails for me. But I don't know how to execute a Linux command from inside Feathers.

Thanks in advance.


Solution

  • It works the same in any node library. Have a look at https://stackoverflow.com/a/35586247/5227141.

    However, I'd suggest you use an imagemagick library like https://github.com/aheckmann/gm.