question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getBuffer without MIME

See original GitHub issue

Is it possible to return the buffer without knowin the MIME?

This example works (by accessing img._originalMime) but I would prefer an official API

const resize = path => {
    return readFile(path)
    .then(buffer => Jimp.read(buffer) )
    .then(img => img.resize(256, Jimp.AUTO))
    .then(img => new Promise((resolve, reject) => {  // resize does not return a promise
        img.getBuffer(img._originalMime, (err, buffer) => {
            if (err) reject(err)
            resolve(buffer)
        })
    }))
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
oliver-morancommented, Jul 26, 2016

Have a few requests for a feature like this. Will do a release this week and hopefully add this to the release after.

0reactions
thisconnectcommented, Aug 13, 2016

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Is it safe to get the allocated only bytes form a byte array ...
My question is is it safe to assume that I can read the array until I encounter the first 0? Do you know...
Read more >
How to use the jimp.MIME_PNG function in jimp - Snyk
Use Snyk Code to scan source code in minutes - no build needed - and fix issues ... getBuffer, { context: image });...
Read more >
Buffer | Node.js v19.3.0 Documentation
The intent is for type to convey the MIME media type of the data, however no validation of the type format is performed....
Read more >
Using Buffers in Node.js - DigitalOcean
A buffer is a space in memory (typically RAM) that stores binary data. In Node.js, we can access these spaces of memory with...
Read more >
ps_get_buffer - Manual - PHP
It will always return an empty string. The idea for a later implementation is to write the contents of the postscript file into...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found