MCPcopy Index your code
hub / github.com/smallstep/cli / getEncoder

Function getEncoder

command/base64/base64.go:119–141  ·  view source on GitHub ↗
(ctx *cli.Context, data []byte)

Source from the content-addressed store, hash-verified

117}
118
119func getEncoder(ctx *cli.Context, data []byte) *base64.Encoding {
120 raw := ctx.Bool("raw")
121 url := ctx.Bool("url")
122 isDecode := ctx.Bool("decode")
123
124 // Detect encoding
125 if isDecode && !ctx.IsSet("raw") && !ctx.IsSet("url") {
126 raw = !bytes.HasSuffix(bytes.TrimSpace(data), []byte("="))
127 url = bytes.Contains(data, []byte("-")) || bytes.Contains(data, []byte("_"))
128 }
129
130 if raw {
131 if url {
132 return base64.RawURLEncoding
133 }
134 return base64.RawStdEncoding
135 }
136 if url {
137 return base64.URLEncoding
138 }
139
140 return base64.StdEncoding
141}

Callers 1

base64ActionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…