MCPcopy Create free account
hub / github.com/mscdex/ssh2 / checkPosition

Function checkPosition

lib/protocol/SFTP.js:3620–3629  ·  view source on GitHub ↗
(pos, name)

Source from the content-addressed store, hash-verified

3618
3619// Check the `this.start` and `this.end` of stream.
3620function checkPosition(pos, name) {
3621 if (!Number.isSafeInteger(pos)) {
3622 validateNumber(pos, name);
3623 if (!Number.isInteger(pos))
3624 throw new ERR_OUT_OF_RANGE(name, 'an integer', pos);
3625 throw new ERR_OUT_OF_RANGE(name, '>= 0 and <= 2 ** 53 - 1', pos);
3626 }
3627 if (pos < 0)
3628 throw new ERR_OUT_OF_RANGE(name, '>= 0 and <= 2 ** 53 - 1', pos);
3629}
3630
3631function roundUpToMultipleOf8(n) {
3632 return (n + 7) & ~7; // Align to 8 byte boundary.

Callers 2

ReadStreamFunction · 0.85
WriteStreamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…