When I try to run a simple example from the doc such as this:
let value = crc32('one');
value = crc32('two', value);
value = crc32('three', value);
value.toString(16);
// "9e1c092"
I get this error:
D:\code\GitHub\file-checker\node_modules\node-crc\lib\lib.js:495
return _crc.crc32(data);
^
TypeError: failed to downcast any to Buffer
at Object.crc32 (D:\code\GitHub\file-checker\node_modules\node-crc\lib\lib.js:495:17)
at file:///D:/code/GitHub/file-checker/index.js:17:17
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
at async loadESM (node:internal/process/esm_loader:91:5)
at async handleMainPromise (node:internal/modules/run_main:65:12)
And, the source of that error is this line of code in node-crc\lib\lib.js:
Which does not even pass the 2nd argument so even if it got past this error, it does not look like it supports the calling style where you pass in the previous crc value because you're accumulating a crc value across many calls. It appears that the documentation is for some other library and not this particular code.
When I try to run a simple example from the doc such as this:
I get this error:
And, the source of that error is this line of code in node-crc\lib\lib.js:
Which does not even pass the 2nd argument so even if it got past this error, it does not look like it supports the calling style where you pass in the previous crc value because you're accumulating a crc value across many calls. It appears that the documentation is for some other library and not this particular code.