I
I
inspekd2019-09-05 09:27:03
Node.js
inspekd, 2019-09-05 09:27:03

Npm jimp - how to return a buffer from jimp?

Good afternoon
, the npm jimp
module has a method image.getBuffer(mime, cb); returning the image to the buffer.
in code it is used like this

jimp.read('1.jpg').getBuffer('image/jpeg',(err,buffer) => {
               DoSomething(buffer)
 })

The question is - how can I rewrite this code so that DoSomething is outside the jimp?
something like ?
x =  jimp.read('1.jpg').getBuffer('image/jpeg',(err,buffer) => {
          return buffer
 })
DoSomething(x)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question