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.

ToBuffer method returns a wrong buffer randomly

example:

sharp(imageFile)
          .resize(myWidth, myHeight)
          .background({r: 0, g: 0, b: 0, alpha: 0})
          .embed()
          .toFormat(sharp.format.jpeg)
          .toBuffer()
          .then(output) => {
// Sometimes buffer cannot be used as uint8Array, it's seems corrupted
console.log(output.buffer);
});

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lovellcommented, May 27, 2018

@josephfrazier You shouldn’t need to do this as sharp always responds with a Buffer assigned via Nan::NewBuffer. Perhaps another dependency is re-defining or monkey-patching the global Buffer class? Please open a new issue with a code sample if you’re able to isolate this behaviour to sharp.

0reactions
josephfraziercommented, May 27, 2018

Thanks for clarifying! I haven’t looked into it closely, but I wouldn’t be surprised if something was being monkey-patched. If I do end up isolating the behavior, I’ll be sure to open an issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SUM ERROR: tp_ins_buffer_entry: wrong buffer format ...
During the upgrading using Software Update manager (SUM), the below error occur at the phase MAIN_SHDIMP/SUBMOD_SHDIMP/BUFFEROP_TABIM EXECUTING ...
Read more >
Problem: An incorrect buffer distance is generated in the ...
Problem: An incorrect buffer distance is generated in the output buffer layer after running the Buffer tool in ArcGIS Pro. Description.
Read more >
Error Codes - Buffer API
HTTP Code Error Code Description 401 401 Unauthorized. 403 403 Permission denied. 404 404 Endpoint not found.
Read more >
Buffer Preparation – Right, Easy, Wrong
This Edition of HPLC solutions is sharing the right way to prepare buffered mobile phase which is more recommended for most reversed-phase HPLC ......
Read more >
Re: PANIC: wrong buffer passed to visibilitymap_clear
Re: PANIC: wrong buffer passed to visibilitymap_clear ; Andres Freund <andres(at)anarazel(dot)de> · Peter Geoghegan <pg(at)bowt(dot)ie>, pgsql- ...
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