https://github.com/ipld/go-codec-dagpb
An implementation of the DAG-PB spec for Go
https://github.com/ipld/go-codec-dagpb
Last synced: about 1 year ago
JSON representation
An implementation of the DAG-PB spec for Go
- Host: GitHub
- URL: https://github.com/ipld/go-codec-dagpb
- Owner: ipld
- License: other
- Created: 2020-09-28T11:49:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-28T13:07:46.000Z (about 1 year ago)
- Last Synced: 2025-03-31T07:07:02.816Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 150 KB
- Stars: 9
- Watchers: 14
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# go-dagpb
**An implementation of the IPLD [DAG-PB](https://github.com/ipld/specs/blob/master/block-layer/codecs/dag-pb.md) spec for [go-ipld-prime](https://github.com/ipld/go-ipld-prime/)**
Use `Decode(ipld.NodeAssembler, io.Reader)` and `Encode(ipld.Node, io.Writer)` directly, or import this package to have this codec registered into the go-ipld-prime CID link loader.
Nodes encoded with this codec _must_ conform to the DAG-PB spec. Specifically, they should have the non-optional fields shown in the DAG-PB schema:
```ipldsch
type PBNode struct {
Links [PBLink]
Data optional Bytes
}
type PBLink struct {
Hash Link
Name optional String
Tsize optional Int
}
```
Use `dagpb.Type.PBNode` and friends directly for strictness guarantees. Basic `ipld.Node`s will need to have the appropraite fields (and no others) to successfully encode using this codec.
## License & Copyright
Copyright © 2020 Protocol Labs
Licensed under either of
* Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0)
* MIT ([LICENSE-MIT](LICENSE-MIT) / http://opensource.org/licenses/MIT)
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.