javascriptnode.jsdeprecatedimagemin

how to pass a buffer to imagemin module in node.js?


In older version of imagemin I was able to pass the module a buffer like so:

new ImageMinify()
    .src(StreamOrBuffer)
    .use(ImageMinify.jpegtran({progressive: true}))

In the current version of imagemin there is no src function and calling the module will result in a promise.

I could not find how to achieve the same result in newer version of imagemin

Could it be done or that the support was removed?


Solution

  • I got an answer from the github repo. I'm posting the answer here in case someone else will encounter the same problem:

    You can supply a buffer using imagemin.buffer. Streams has never been supported.