Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@dcl/hashing

decentraland5.3kApache-2.03.0.4TypeScript support: included

base component

readme

@dcl/hashing

Hashing functions to calculate Decentraland Content Identifiers

  • hashV1(arg): Promise<string>: ba prefixed hashes are IPFSv1 hashes. Calculating hashes for files should generate the same result as an IPFS node.
  • DEPRECATED hashV0(arg): Promise<string>: Qm prefixed hashes are not IPFSv0 hashes, although it uses the same encoding (Qm...). These

npm i @dcl/hashing

import { hashV1 } from '@dcl/hashing'

// use with Node.js Buffers or Uint8Array
cid = await hashV1(fs.readFileSync('file'))

// use with fs.ReadStream
cid = await hashV1(fs.createReadStream('file'))

// => bafybeibdik2ihfpcdi7aaaguptwcoc5msav7uhn5hu54xlq2pdwkh5arzy