@dcl/hashing
v1.2.0
Published
Hashing functions to calculate Decentraland Content Identifiers
Readme
@dcl/hashing
Hashing functions to calculate Decentraland Content Identifiers.
hashV1(arg): Promise<string>:baprefixed hashes are IPFSv1 hashes. Calculating hashes for files should generate the same result as an IPFS node.hashV0(arg): Promise<string>:Qmprefixed hashes are not IPFSv0 hashes, although they use the same encoding. This function is deprecated and kept for backwards compatibility.
npm i @dcl/hashingimport { hashV1 } from '@dcl/hashing'
import fs from 'node:fs'
const cidFromBuffer = await hashV1(fs.readFileSync('file'))
const cidFromStream = await hashV1(fs.createReadStream('file') as AsyncIterable<Uint8Array>)