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

fs: improve argument handling for ReadStream #19898

Closed
wants to merge 26 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e507f93
fs: improve argument handling for ReadStream
ryzokuken Apr 9, 2018
30c285f
test,fs: update tests for improvements in ReadStream
ryzokuken Apr 10, 2018
915d77c
Remove inconsistency
ryzokuken Apr 10, 2018
17d6d55
Separate testing for start and end
ryzokuken Apr 10, 2018
36574f4
Remove invalid check
ryzokuken Apr 10, 2018
e4415d5
Address comments regarding handling undefined
ryzokuken Apr 10, 2018
b946616
Refactor conditions
ryzokuken Apr 11, 2018
d00b46a
fs,doc: add documentation regarding changes to createReadStream
ryzokuken Apr 13, 2018
93b0915
Add a changes block and move new documentation towards the end
ryzokuken Apr 14, 2018
5d03199
Replace version by REPLACEME
ryzokuken Apr 14, 2018
047529b
Minimize comments and documentation
ryzokuken Apr 15, 2018
a90457b
Address nit by adding parens
ryzokuken Apr 15, 2018
c3be59a
Resolve merge conflict
ryzokuken Apr 16, 2018
41b3a2e
Thow RangeError on fractional values
ryzokuken Apr 20, 2018
3530baa
Cleanup fs.md
ryzokuken Apr 23, 2018
4863dba
Fix error
ryzokuken Apr 24, 2018
1cf1814
Fix failures
ryzokuken Apr 25, 2018
2c35628
Address nit
ryzokuken Apr 26, 2018
a24f115
Use isSafeInteger over isInteger
ryzokuken Apr 27, 2018
0368397
Change error message
ryzokuken Apr 29, 2018
b6fa515
Improve error handling
ryzokuken May 5, 2018
7bda63c
Refactor fs tests for brevity
ryzokuken May 5, 2018
c34ba43
Address nits
ryzokuken May 8, 2018
30e36c2
Update RangeError error message
ryzokuken May 9, 2018
9af225c
Update RangeError error message v2
ryzokuken May 9, 2018
c76e75a
Fix lint errors
ryzokuken May 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix failures
ryzokuken committed Apr 25, 2018
commit 1cf1814d922818b38416d5803a5f41d937fae218
2 changes: 1 addition & 1 deletion lib/fs.js
Original file line number Diff line number Diff line change
@@ -2033,7 +2033,7 @@ function ReadStream(path, options) {
this.pos = this.start;
}

if (this.end === undefined) {
if (this.end === undefined || this.end === Infinity) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could save an unnecessary assignment if you move this condition to the else and make it else if (this.end !== Infinity).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do, sure.

this.end = Infinity;
} else {
if (typeof this.end !== 'number') {