multiformats
Bindings to the js implementation of multiformats.
Currently only the sha256 hasher is supported.
npm install --save multiformats@13
gleam add multiformats@1
import dag_json
import multiformats/cid
import multiformats/hashes/sha256
pub fn main() {
let data = // some json
let bytes = dag_json.encode(data)
let multihash = sha256.digest(bytes)
cid.create_v1(dag_json.code(), multihash)
|> cid.to_string
}
Further documentation can be found at https://hexdocs.pm/multiformats.
Development
gleam run # Run the project
gleam test # Run the tests
Credit
Created for EYG, a new integration focused programming language.