Skip to content

Offset must be >= 0 && <= 0 Out of range 0 :-) #21193

Closed
@amno1

Description

internal/fs/utils.js:353
throw err;
^

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 && <= 0. Received 0
at Object.fs.readSync (fs.js:626:3)
at Object. (/home/arthur/serialkeys/dbtest/getkeys.js:11:14)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
at startup (internal/bootstrap/node.js:238:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)

I am trying to read a file and I am getting error when trying to read at beginning. As seen above, it says offset must be >= 0 and <= 0. It is very interesting error message i must say. Anyway I am using offset 0 and I get that error :-). I am just trying to read 10 bytes into an Uint8Array. Here is the call

let string = new Uint8Array();
let num = fs.readSync(keyfile, string, 0, 10, 0)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    errorsIssues and PRs related to JavaScript errors originated in Node.js core.fsIssues and PRs related to the fs subsystem / file system.good first issueIssues that are suitable for first-time contributors.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions