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.

Generate buffer from image in browser

See original GitHub issue

So I’m using the library on browser-side without nodeJS. In the docs the method document.createImage() requires a buffer. I’m using a library to implement the nodeJS buffer functionality in the browser but I honestly have no clue about how to proceed without having to implement fileSystem functionality.

I’d like to use an URL to load the image. Thanks for any help!

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
dolanmiucommented, Jan 10, 2019

Buffer is only supported in NodeJS, there is no such concept as buffer in the browser world!

Fortunately, createImage() can also take in a base64 string or a Uint8Array or ArrayBuffer, which are in the browser world:

https://github.com/dolanmiu/docx/blob/master/src/file/file.ts#L139

1reaction
hmouhtarcommented, Jan 14, 2019

Makes sense. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to load an image from url into buffer in nodejs
This will download the image from url and produce a buffer with the image data. Using the request library - const request =...
Read more >
Comprehensive Image Processing on Browsers - vivaxy's Blog
You can create a ImageData by <canvas> API createImageData or the ImageData constructor. Buffer. ArrayBuffer. There is only one way of accessing ...
Read more >
WebGLRenderbuffer - Web APIs | MDN
The WebGLRenderbuffer interface is part of the WebGL API and represents a buffer that can contain an image, or that can be a...
Read more >
How to decode a binary buffer to an image in node.js?
Look at the various Buffer.from methods and pick what's appropriate, or just go with the Blob constructor directly if you've already got a ......
Read more >
How to fetch images from Node.js server ? - GeeksforGeeks
Open any browser and to go http://localhost:3000/images/geeksforgeeks.png and you will see the following output:.
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