MCPcopy Create free account
hub / github.com/libgit2/git2go / Contents

Method Contents

blob.go:33–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31}
32
33func (v *Blob) Contents() []byte {
34 size := C.int(C.git_blob_rawsize(v.cast_ptr))
35 buffer := unsafe.Pointer(C.git_blob_rawcontent(v.cast_ptr))
36
37 goBytes := C.GoBytes(buffer, size)
38 runtime.KeepAlive(v)
39
40 return goBytes
41}
42
43func (v *Blob) IsBinary() bool {
44 ret := C.git_blob_is_binary(v.cast_ptr) == 1

Callers 2

TestCreateBlobFromBufferFunction · 0.80

Calls

no outgoing calls

Tested by 2

TestCreateBlobFromBufferFunction · 0.64