Documentation
¶
Index ¶
- Constants
- func ETag(contents []byte) (string, error)
- func FormatFileSize(sizeBytes int64) string
- func ParseFileSize(fileSizeValue string) int64
- func ReadChunks(filePath string, chunkSize int, handler func([]byte) error) error
- func ReadLines(filePath string, handler func(string) error) error
- func RemoveMany(filePaths ...string) error
- type Temp
- func (tf *Temp) Close() error
- func (tf *Temp) Name() string
- func (tf *Temp) Read(buffer []byte) (int, error)
- func (tf *Temp) ReadAt(buffer []byte, off int64) (int, error)
- func (tf *Temp) Stat() (os.FileInfo, error)
- func (tf *Temp) Write(contents []byte) (int, error)
- func (tf *Temp) WriteAt(contents []byte, off int64) (int, error)
- func (tf *Temp) WriteString(contents string) (int, error)
Constants ¶
const ( // Kilobyte represents the bytes in a kilobyte. Kilobyte int64 = 1 << 10 // Megabyte represents the bytes in a megabyte. Megabyte int64 = Kilobyte << 10 // Gigabyte represents the bytes in a gigabyte. Gigabyte int64 = Megabyte << 10 //Terrabyte represents the bytes in a terrabyte. Terrabyte int64 = Gigabyte << 10 )
Variables ¶
This section is empty.
Functions ¶
func FormatFileSize ¶
FormatFileSize returns a string representation of a file size in bytes.
func ParseFileSize ¶
ParseFileSize parses a file size
func ReadChunks ¶
ReadChunks reads a file in `chunkSize` pieces, dispatched to the handler.
Types ¶
type Temp ¶
Temp is a file that deletes itself when closed. It does not hold a file handle open, so no guarantees are made around the file persisting for the lifetime of the object.
func (*Temp) Read ¶
Read reads up to len(b) bytes from the File. It returns the number of bytes read and any error encountered. At end of file, Read returns 0, io.EOF.
func (*Temp) ReadAt ¶
ReadAt reads len(b) bytes from the File starting at byte offset off. It returns the number of bytes read and the error, if any. ReadAt always returns a non-nil error when n < len(b). At end of file, that error is io.EOF.
func (*Temp) Stat ¶
Stat returns a FileInfo describing the named file. If there is an error, it will be of type *PathError.
func (*Temp) Write ¶
Write writes len(b) bytes to the File. It returns the number of bytes written and an error, if any. Write returns a non-nil error when n != len(b).