Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v6.x] fs: fix createReadStream(…, {end: n}) for non-seekable fds #19411

Closed
wants to merge 2 commits into from

Commits on Mar 17, 2018

  1. fs: fix createReadStream(…, {end: n}) for non-seekable fds

    82bdf8f fixed an issue by silently modifying the `start`
    option for the case when only `end` is passed, in order to perform
    reads from a specified range in the file.
    
    However, that approach does not work for non-seekable files, since
    a numeric `start` option means that positioned reads will be used
    to read data from the file.
    
    This patch fixes that, and instead ends reading after a specified
    size by adjusting the read buffer size.
    
    This way we avoid re-introducing the bug that 82bdf8f fixed,
    and align behaviour with the native file stream mechanism
    introduced in nodejs#18936 as well.
    
    PR-URL: nodejs#19329
    Fixes: nodejs#19240
    Refs: nodejs#18121
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Chen Gang <gangc.cxy@foxmail.com>
    addaleax committed Mar 17, 2018
    Configuration menu
    Copy the full SHA
    49dca19 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    eff7250 View commit details
    Browse the repository at this point in the history