Documentation ¶
Index ¶
- Constants
- Variables
- func ByteSize(bytes uint64) string
- func Clear(p []byte)
- func ClearRange(p []byte, start, end int)
- func ExistFile(filePath string) (ok bool)
- func ReadRegion(reader io.ReaderAt, offset int64, capacity int64) (p []byte, err error)
- func SyncDir(dir string) (err error)
- func ToBytes(s string) (uint64, error)
- func ToMegabytes(s string) (uint64, error)
- func WriteRegion(writer io.WriterAt, offset int64, p []byte) (err error)
- type File
- func (f *File) Close() (err error)
- func (f *File) File() (file *os.File)
- func (f *File) ReadAt(offset int64, capacity int64) (p []byte, err error)
- func (f *File) ReadRegion(offset int64, capacity int64) (region FileRegion, err error)
- func (f *File) Size() (n int64, err error)
- func (f *File) Sync() (err error)
- func (f *File) WriteAt(offset int64, p []byte) (err error)
- type FileRegion
Constants ¶
View Source
const ( BYTE = 1 << (10 * iota) KILOBYTE MEGABYTE GIGABYTE TERABYTE PETABYTE EXABYTE )
Variables ¶
View Source
var InvalidByteQuantityError = errors.New("byte quantity must be a positive integer with a unit of measurement like M, MB, MiB, G, GiB, or GB")
Functions ¶
func ByteSize ¶
ByteSize returns a human-readable byte string of the form 10M, 12.5K, and so forth. The following units are available:
E: Exabyte P: Petabyte T: Terabyte G: Gigabyte M: Megabyte K: Kilobyte B: Byte
The unit that results in the smallest number greater than or equal to 1 is always chosen.
func ClearRange ¶
func ReadRegion ¶
func ToBytes ¶
ToBytes parses a string formatted by ByteSize as bytes. Note binary-prefixed and SI prefixed units both mean a base-2 units KB = K = KiB = 1024 MB = M = MiB = 1024 * K GB = G = GiB = 1024 * M TB = T = TiB = 1024 * G PB = P = PiB = 1024 * T EB = E = EiB = 1024 * P
func ToMegabytes ¶
ToMegabytes parses a string formatted by ByteSize as megabytes.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) ReadRegion ¶
func (f *File) ReadRegion(offset int64, capacity int64) (region FileRegion, err error)
type FileRegion ¶
type FileRegion interface { io.ReaderAt io.ReadCloser Bytes() (p []byte) }
Click to show internal directories.
Click to hide internal directories.