vseventer / sharp-cli

CLI for sharp.
MIT License
189 stars 20 forks source link

Overwriting the input files failes in Node v16.4.1 #57

Closed KasparEtter closed 2 years ago

KasparEtter commented 3 years ago
sharp resize 100 --input '*.png' --output '{dir}'

works in Node v14.17.2 but fails in Node v16.4.1 with the following error message:

The value of "position" is out of range. It must be an integer. Received Infinity

By inserting logger.error(err.stack) in index.js, I got the following stack trace:

RangeError [ERR_OUT_OF_RANGE]: The value of "position" is out of range. It must be an integer. Received Infinity
    at read (node:fs:653:3)
    at node:internal/util:335:7
    at new Promise (<anonymous>)
    at read (node:internal/util:321:12)
    at Readable.read [as _read] (/[…]/sharp-cli/node_modules/rw-stream/index.js:43:39)
    at Readable.read (node:internal/streams/readable:483:10)
    at resume_ (node:internal/streams/readable:981:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
vseventer commented 2 years ago

Fixed in v2.0.0.