dag_json
Bindings to the js implementation of dag-json.
npm install --save @ipld/dag-json@10
gleam add dag_json@1
import dag_json as codec
pub fn code_test() {
codec.code()
|> should.equal(297)
}
pub fn name_test() {
codec.name()
|> should.equal("dag-json")
}
// dag-json has a convention for encoding binary data
pub fn encode() {
codec.binary(<<1, 2>>)
|> codec.encode
}
pub fn decode() {
<<"{\"bar\":\"baz\"}">>
|> codec.decode
}
Further documentation can be found at https://hexdocs.pm/dag_json.
Development
gleam run # Run the project
gleam test # Run the tests
Credit
Created for EYG, a new integration focused programming language.