Skip to content

In leu of https://github.com/multiformats/js-multiformats/pull/261 landing, this PR uses the nodejs crypto library to create a streaming sha256 hasher. #23496

@sangshanrupesh

Description

@sangshanrupesh

In leu of multiformats/js-multiformats#261 landing, this PR uses the nodejs crypto library to create a streaming sha256 hasher.

Before:

$ ipfs-car hash snow.car 
node:internal/fs/promises:516
    throw new ERR_FS_FILE_TOO_LARGE(size);
          ^

RangeError [ERR_FS_FILE_TOO_LARGE]: File size (11998084756) is greater than 2 GiB
    at readFileHandle (node:internal/fs/promises:516:11)
    at async Module.hash (file:///usr/local/lib/node_modules/ipfs-car/cmd/hash.js:13:13) {
  code: 'ERR_FS_FILE_TOO_LARGE'
}

Node.js v20.11.0

After:

$ ipfs-car hash snow.car
bagbaierabdsb7q55nozng74qw267etolakl4jwrszyjb5elw43zercwmowva

(Note: snow.car is an 11GB CAR)

resolves storacha/ipfs-car#158

Originally posted by @alanshaw in storacha/ipfs-car#162

┆Issue is synchronized with this Jira Task

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions