{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package util\n\n## Functions\n\n```go\nfunc CreateDirIfMissing(dirPath string) (bool, error)\n```\nCreateDirIfMissing creates a dir for dirPath if not already exists. If the dir is empty it returns true\n\n```go\nfunc DecodeOrderPreservingVarUint64(bytes []byte) (uint64, int, error)\n```\nDecodeOrderPreservingVarUint64 decodes the number from the bytes obtained from method 'EncodeOrderPreservingVarUint64'. It returns the decoded number, the number of bytes that are consumed in the process, and an error if the input bytes are invalid.\n\n```go\nfunc DirEmpty(dirPath string) (bool, error)\n```\nDirEmpty returns true if the dir at dirPath is empty\n\n```go\nfunc EncodeOrderPreservingVarUint64(number uint64) []byte\n```\nEncodeOrderPreservingVarUint64 returns a byte-representation for a uint64 number such that all zero-bits starting bytes are trimmed in order to reduce the length of the array For preserving the order in a default bytes-comparison, first byte contains the number of remaining bytes. The presence of first byte also allows to use the returned bytes as part of other larger byte array such as a composite-key representation in db\n\n```go\nfunc FileExists(filePath string) (bool, int64, error)\n```\nFileExists checks whether the given file exists. If the file exists, this method also returns the size of the file.\n\n```go\nfunc ListSubdirs(dirPath string) ([]string, error)\n```\nListSubdirs returns the subdirectories\n\n## Types\n\n```go\ntype Buffer struct {\n\t// contains filtered or unexported fields\n}\n```\nBuffer provides a wrapper on top of proto.Buffer. The purpose of this wrapper is to get to know the current position in the \\[]byte\n\n```go\nfunc NewBuffer(b []byte) *Buffer\n```\nNewBuffer constructs a new instance of Buffer\n\n```go\nfunc (b *Buffer) DecodeRawBytes(alloc bool) ([]byte, error)\n```\nDecodeRawBytes wraps the actual method and updates the position\n\n```go\nfunc (b *Buffer) DecodeVarint() (uint64, error)\n```\nDecodeVarint wraps the actual method and updates the position\n\n```go\nfunc (b *Buffer) GetBytesConsumed() int\n```\nGetBytesConsumed returns the offset of the current position in the underlying \\[]byte\n\n","path":"github.com/eric-erki/https-hyperledger.org/common/ledger/util","name":"util","synopsis":"","isRedistributable":true}
