Node Newb Image Handling

nodejs

#1

So I am a newb. I did figure out how to make a request, well using request, in node to an API to retrieve a bunch of images. I figured out how to put them into an array and use the fs module and writeFileStream i think it was to save them locally in my workspace. what i want to be able to do is to shrink the images and send them along to Slack via my bot. I have got the sending part figured out, but I have two problems.

One

  • I don’t know how to shrink these files programmatically. I thought maybe since the workspace has an image editor natively that there might be some way to use it programmatically?? I have read some documentation on various packages that might shrink images but I only have 2 months total coding experience and some of that stuff is confusing. I am dealing with .png

Two

  • I need to send the files as links. such as https://<username>-<workspace>.c9.io/file.png or whatever. Is that even possible. I thought maybe express could somehow server them up as static assets since I have used express.static for other stuff. But I am not sure. Any insight into these issues is appreciated. Thanks.