Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7816693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:57:38+00:00 2026-06-02T05:57:38+00:00

I’ve written a simple Node.js app that streams content (primarily for videos, but other

  • 0

I’ve written a simple Node.js app that streams content (primarily for videos, but other stuff works too). It seems to work fine except with some jpegs, where the bottom of the image is not always displayed.

Here’s an example, with the bottom portion of the picture missing on the left.

enter image description here

A site showing the problem is here and an identical-looking site without the problem is here. (There should be pink bits at the bottom of most images with the first link.)

The code for the app is on Github, but I guess the important lines are

stream = fs.createReadStream(info.file, { flags: "r", start: info.start, end: info.end });
stream.pipe(res);

(So all of the heavy lifting is done by stream.js, not my code.)

  • I’ve tried removing the start and end params, but it makes no difference.
  • If I change it to stream the file to process.stdout instead and save the output to a file, the whole image is shown.
  • A file comparison program says the file from stdout and the original are identical.
  • If I transfer something other than a baseline jpeg (so even progressive jpegs work), it shows the whole file.*
  • If I access the file via the linked Node.js app (which uses Express), but not through the streamer, it shows the whole image.
  • If I save the incomplete picture from my browser to the desktop, it saves the whole image.
  • For some jpegs it works, but not for most.
  • The problem happens locally and on my server (Windows 2008 R2 and Ubuntu 11 resp.).

Browser tests (over 3 computers & 1 VM)

  • Safari 4, 5 – works
  • Firefox 4, 11 (2 computers) – doesn’t work
  • Chrome 18 (2 computers) – doesn’t work
  • IE 8 – doesn’t work
  • IE 9 – works
  • Opera 11 – works

I really have no idea what’s going on here. I thought it could be a weird graphics driver bug, but the behaviour is consistent across all computers I’ve tried. I find it hard to blame Node.js / my code for this as it does seem to be transferring the whole of the file, but then it works fine without it.

Happy to supply more details if needed.

* Obviously I haven’t tried every possible file type, but pngs, progressive jpegs, text and videos seem to work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T05:57:39+00:00Added an answer on June 2, 2026 at 5:57 am

    It turns out that the problem was the file size sent in the header (header["Content-Length"]). I’d set this to info.end - info.start, whereas the actual size is 1 more than that. Some browsers didn’t like this and missed off the end of the picture when displaying it on screen. Oops.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.