cid -> bytes command

This commit is contained in:
zenground0 2023-01-17 12:15:34 -07:00
parent 14d921f64f
commit 72baa3d916

View File

@ -30,6 +30,22 @@ var cidCmd = &cli.Command{
cidIdCmd, cidIdCmd,
inspectBundleCmd, inspectBundleCmd,
cborCid, cborCid,
cidBytes,
},
}
var cidBytes = &cli.Command{
Name: "bytes",
Usage: "cid bytes",
ArgsUsage: "[cid]",
Action: func(cctx *cli.Context) error {
c, err := cid.Decode(cctx.Args().First())
if err != nil {
return err
}
// Add in the troublesome zero byte prefix
fmt.Printf("00%x\n", c.Bytes())
return nil
}, },
} }