fs: check start option more strict in createWriteStream by ZYSzys · Pull Request #25579 · nodejs/node (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

ZYSzys wants to merge1 commit intonodejs:masterfromzys-contrib:fs-internal-writeStream

Conversation10 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

ZYSzys

Use checkPosition function to check the start option that passed into fs.createWriteStream more strictly, and be the same as the start option that passed into fs.createReadStream.

// Check the `this.start` and `this.end` of stream.
function checkPosition(pos, name) {
if (!Number.isSafeInteger(pos)) {
validateNumber(pos, name);
if (!Number.isInteger(pos))
throw new ERR_OUT_OF_RANGE(name, 'an integer', pos);
throw new ERR_OUT_OF_RANGE(name, '>= 0 and <= 2 ** 53 - 1', pos);
}
if (pos < 0) {
throw new ERR_OUT_OF_RANGE(name, '>= 0 and <= 2 ** 53 - 1', pos);
}
}
Checklist

@addaleax

jasnell

@jasnell jasnell added the semver-major

PRs that contain breaking changes and should be released in the next major version.

label

Jan 28, 2019

thefourtheye

@lpinca

lpinca

lpinca

lpinca

@lpinca lpinca added the author ready

PRs that have at least one approval, no pending requests for changes, and a CI started.

label

Feb 9, 2019

@ZYSzys

@lpinca

@lpinca

lpinca pushed a commit that referenced this pull request

Feb 10, 2019

@ZYSzys @lpinca

PR-URL: #25579 Reviewed-By: James M Snell jasnell@gmail.com Reviewed-By: Sakthipriyan Vairamani thechargingvolcano@gmail.com Reviewed-By: Luigi Pinca luigipinca@gmail.com

@ZYSzys ZYSzys deleted the fs-internal-writeStream branch

February 10, 2019 08:31

BethGriggs added a commit that referenced this pull request

Apr 22, 2019

@BethGriggs

Notable changes:

PR-URL: #26930

BethGriggs added a commit that referenced this pull request

Apr 23, 2019

@BethGriggs

Notable changes:

PR-URL: #26930

BethGriggs added a commit that referenced this pull request

Apr 23, 2019

@BethGriggs

Notable changes:

PR-URL: #26930

This was referenced

Apr 23, 2019

Labels

author ready

PRs that have at least one approval, no pending requests for changes, and a CI started.

fs

Issues and PRs related to the fs subsystem / file system.

semver-major

PRs that contain breaking changes and should be released in the next major version.