Skip to content

Commit

Permalink
cid -> bytes command
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenGround0 committed Jan 17, 2023
1 parent 14d921f commit 72baa3d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cmd/lotus-shed/cid.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ var cidCmd = &cli.Command{
cidIdCmd,
inspectBundleCmd,
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
},
}

Expand Down

0 comments on commit 72baa3d

Please sign in to comment.