Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ext ¶
Ext will retrieve a non-compression related file extension. If there are multiple, it returns the first behind the compression extension. It is assumed the compression extension is last.
Only supports '.gz' at the moment.
func OpenTmp ¶
OpenTmp will open and create a temp file It will create necessary directories.
Example (Err) ¶
// showing: // closeF no err on nil f _, _, err := OpenTmp("/root/bad", "") isDenied := os.IsPermission(err) fmt.Println(isDenied) // output: true
Output: true
Types ¶
type HashCloser ¶
func NewMD5Closer ¶
func NewMD5Closer() *HashCloser
func (*HashCloser) Close ¶
func (h *HashCloser) Close() error
type HashReader ¶
HashReader executes the underlying reader Read call and will write the read bytes into the hasher. This is useful when you want the hasher to get at the raw bytes of the reader.
func NewHashReader ¶
func NewHashReader(hshr hash.Hash, r io.Reader) *HashReader
type MultiWriteCloser ¶
type MultiWriteCloser struct {
// contains filtered or unexported fields
}
Example ¶
// showing: // - write err // - close err // - short write err // write, close err errW := new(errWriteCloser) writers := make([]io.WriteCloser, 1) writers[0] = errW w := NewMultiWriteCloser(writers) _, err := w.Write([]byte("test err")) fmt.Println(err) // error writing err = w.Close() fmt.Println(err) // error closing // short write err errShort := new(shortWriteCloser) writers[0] = errShort w = NewMultiWriteCloser(writers) _, err = w.Write([]byte("test short")) fmt.Println(err) // short write
Output: error writing error closing short write
func NewMultiWriteCloser ¶
func NewMultiWriteCloser(writers []io.WriteCloser) *MultiWriteCloser
func (*MultiWriteCloser) Close ¶
func (mw *MultiWriteCloser) Close() (err error)
type NopCloser ¶
NopCloser will turn a Writer into an io.WriteCloser Write will call the original write Write method. Close will do nothing.
func NewNopWriteCloser ¶
Click to show internal directories.
Click to hide internal directories.