Skip to content

Instantly share code, notes, and snippets.

@woss
Created November 21, 2018 12:15
Show Gist options
  • Save woss/83d01dce3368c785f5703e6a4e8c8ca2 to your computer and use it in GitHub Desktop.
Save woss/83d01dce3368c785f5703e6a4e8c8ca2 to your computer and use it in GitHub Desktop.
import * as mh from 'multihashes'
import * as fs from 'fs'
import * as path from 'path'
const imagePath = path.resolve(rootPath, image)
const buf = fs.readFileSync(imagePath)
const hash = mh.encode(buf, 'sha2-256')
consle.log(mh.toB58String(hash))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment