MCPcopy
hub / github.com/cli/cli / IsBinaryFile

Function IsBinaryFile

pkg/cmd/gist/shared/shared.go:197–211  ·  view source on GitHub ↗
(file string)

Source from the content-addressed store, hash-verified

195}
196
197func IsBinaryFile(file string) (bool, error) {
198 detectedMime, err := mimetype.DetectFile(file)
199 if err != nil {
200 return false, err
201 }
202
203 isBinary := true
204 for mime := detectedMime; mime != nil; mime = mime.Parent() {
205 if mime.Is("text/plain") {
206 isBinary = false
207 break
208 }
209 }
210 return isBinary, nil
211}
212
213func IsBinaryContents(contents []byte) bool {
214 isBinary := true

Callers 1

processFilesFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected