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.

Adding images doesn't work in the browser

See original GitHub issue

Using Browserify width PDFKit works great, but there’s an issue with brfs when trying to add an image (see https://github.com/substack/brfs/issues/36).

Trying to add an image gives you this in the console:

TypeError: fs.readFileSync is not a function

Basically, the transform for fs.readFileSync() only works when a string is the first parameter. Line 30 of image.js seems to be the problem:

data = fs.readFileSync(src);

Try adding any image to the demo and you get the same thing. The issue referenced above in the brfs repo has been open since October and doesn’t sound trivial. Any suggestions for a way round this problem?

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
simonbernardcommented, Feb 12, 2016

There is a simple workaround when using browserify.

require('buffer');
var arraybuffer = 'image from server';
doc.image(new Buffer(arraybuffer));

It worked fine for me.

0reactions
blikblumcommented, Sep 14, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

7 Reasons Why Images Are Not Loading on Your Website
Website images fail to load for one of these seven common reasons.
Read more >
7 Ways to Fix Google Chrome Not Loading Images - MakeUseOf
Open Chrome's menu and head to Settings. · From the left pane, click Privacy and security. · Click Site Settings > Images. ·...
Read more >
[Answer] Why and How to Fix Images Not Showing on Website?
Fix 1: Open the Image in a Different Browser ... Most of the time, due to some bugs in the browser you are...
Read more >
Resolve the "Images Not Showing on Website" Error [2022]
To resolve the images not showing problem, just close Chrome and open the Run prompt. Now, enter the '%localappdata%' command to go to...
Read more >
How to Fix Images Not Loading in Chrome - Online Tech Tips
How to Fix Images Not Loading in Chrome · Use a Different Browser to Access Your Webpage · Allow Sites to Display Images...
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