Versions in this module Expand all Collapse all v0 v0.1.0 Oct 24, 2022 Changes in this version + const DefaultOpenTimeout + var CompareHasher hash.Hash = sha256.New() + var DirExists = pathutil.DirExists + var Exists = pathutil.Exists + var ExpandUser = pathutil.ExpandUser + var FileExists = pathutil.FileExists + var GenericDefaultTimeout = 5 * time.Second + var HttpDefaultTimeout = 10 * time.Second + var IsAppend = pathutil.IsAppend + var IsAppendable = pathutil.IsAppendable + var IsCharDevice = pathutil.IsCharDevice + var IsDevice = pathutil.IsDevice + var IsExclusive = pathutil.IsExclusive + var IsNamedPipe = pathutil.IsNamedPipe + var IsNonemptyDir = pathutil.IsNonemptyDir + var IsNonemptyExecutableFile = pathutil.IsNonemptyExecutableFile + var IsNonemptyFile = pathutil.IsNonemptyFile + var IsReadable = pathutil.IsReadable + var IsSetgid = pathutil.IsSetgid + var IsSetuid = pathutil.IsSetuid + var IsSocket = pathutil.IsSocket + var IsSticky = pathutil.IsSticky + var IsSymlink = pathutil.IsSymlink + var IsTemporary = pathutil.IsTemporary + var IsWritable = pathutil.IsWritable + var LinkExists = pathutil.LinkExists + var NullReadCloser = ioutil.NopCloser(bytes.NewBuffer(nil)) + var SkipToken = errors.New(`skip token`) + var SshDefaultTimeout = 10 * time.Second + var SshPrivateKey = MustExpandUser(`~/.ssh/id_rsa`) + var SshVerifyHostFunc ssh.HostKeyCallback + func AddMimeTypeFile(filename string) + func Cat(file interface{}) string + func ChecksumFile(filename string, fn interface{}) ([]byte, error) + func CompareReaders(a io.Reader, b io.Reader, hasher ...hash.Hash) int + func CopyDir(root string, fn CopyEntryFunc) error + func CopyFile(source interface{}, destination interface{}) error + func GetMimeType(filenameOrReader interface{}, fallback ...string) string + func GetNthLine(file interface{}, number int) (string, error) + func InitMime() + func IsModifiedAfter(stat os.FileInfo, current string) bool + func IsTerminal() bool + func MustExpandUser(path string) string + func MustGetNthLine(file interface{}, number int) string + func MustReadAll(file interface{}) []byte + func MustReadAllLines(file interface{}) []string + func MustReadAllString(file interface{}) string + func MustWriteFile(input interface{}, filename string) int64 + func MustWriteTempFile(input interface{}, prefix string) string + func Open(uri string) (io.Reader, error) + func OpenWithOptions(uri string, options OpenOptions) (io.Reader, error) + func ReadAll(file interface{}) ([]byte, error) + func ReadAllLines(file interface{}) ([]string, error) + func ReadAllString(file interface{}) (string, error) + func ReadFirstLine(file interface{}) (string, error) + func RegisterOpenHandler(scheme string, handler OpenHandler) + func RegisterRetrieveScheme(scheme string, fn RetrieveHandlerFunc) + func RemoveBlankLines(data []byte) ([]byte, error) + func RemoveOpenHandler(scheme string) + func Retrieve(ctx context.Context, resourceUri interface{}) (io.ReadCloser, error) + func RetrieveViaFilesystem(ctx context.Context, u *url.URL) (io.ReadCloser, error) + func RetrieveViaHTTP(ctx context.Context, u *url.URL) (io.ReadCloser, error) + func RetrieveViaSSH(ctx context.Context, u *url.URL) (io.ReadCloser, error) + func SameFile(first interface{}, second interface{}) bool + func SetExt(path string, ext string, oldexts ...string) string + func ShouldGetNthLine(file interface{}, number int) string + func ShouldReadAllLines(file interface{}) []string + func SizeOf(path string) convutil.Bytes + func UnregisterRetrieveScheme(scheme string) + func WriteFile(input interface{}, filename string) (int64, error) + func WriteTempFile(input interface{}, pattern string) (string, error) + type CloserFunc = func(io.ReadCloser) error + type CopyEntryFunc func(path string, info os.FileInfo, err error) (io.Writer, error) + type DirReader struct + func NewDirReader(path string, options ...DirReaderOption) *DirReader + func (self *DirReader) Close() error + func (self *DirReader) Read(b []byte) (int, error) + func (self *DirReader) SetSkipFunc(fn SkipFunc) + type DirReaderOption int + const FailOnError + const NoRecursive + type DirReaderOptions []DirReaderOption + func (self DirReaderOptions) Has(option DirReaderOption) bool + type ExtendableReader struct + func (self *ExtendableReader) AppendSource(rc io.ReadCloser) + func (self *ExtendableReader) Close() error + func (self *ExtendableReader) Read(b []byte) (int, error) + type FileInfo struct + func NewFileInfo(wrap ...os.FileInfo) *FileInfo + func (self *FileInfo) IsDir() bool + func (self *FileInfo) ModTime() time.Time + func (self *FileInfo) Mode() os.FileMode + func (self *FileInfo) Name() string + func (self *FileInfo) SetIsDir(isDir bool) + func (self *FileInfo) SetModTime(mtime time.Time) + func (self *FileInfo) SetMode(mode os.FileMode) + func (self *FileInfo) SetName(name string) + func (self *FileInfo) SetSize(sz int64) + func (self *FileInfo) SetSys(iface interface{}) + func (self *FileInfo) Size() int64 + func (self *FileInfo) Sys() interface{} + type MultiCloser struct + func NewMultiCloser(closers ...io.Closer) *MultiCloser + func (self *MultiCloser) Close() (merr error) + type OpenHandler func(*url.URL, OpenOptions) (io.ReadCloser, error) + type OpenOptions struct + Insecure bool + Timeout time.Duration + func (self OpenOptions) GetTimeout() time.Duration + type PostReadCloser struct + func NewPostReadCloser(upstream io.ReadCloser, closer CloserFunc) *PostReadCloser + func (self *PostReadCloser) Close() error + func (self *PostReadCloser) Read(b []byte) (int, error) + type ReadManipulator struct + func NewReadManipulator(reader io.Reader, fns ...ReadManipulatorFunc) *ReadManipulator + func (self *ReadManipulator) Close() error + func (self *ReadManipulator) Read(b []byte) (int, error) + func (self *ReadManipulator) Split(split bufio.SplitFunc) + type ReadManipulatorFunc func(data []byte) ([]byte, error) + func ManipulateAll(fns ...ReadManipulatorFunc) ReadManipulatorFunc + func RemoveLinesContaining(needle string) ReadManipulatorFunc + func RemoveLinesSurroundedBy(prefix string, suffix string, trimSpace bool) ReadManipulatorFunc + func RemoveLinesWithPrefix(prefix string, trimSpace bool) ReadManipulatorFunc + func RemoveLinesWithSuffix(suffix string, trimSpace bool) ReadManipulatorFunc + func ReplaceWith(find string, replace string, occurrences int) ReadManipulatorFunc + type RetrieveHandlerFunc = func(context.Context, *url.URL) (io.ReadCloser, error) + type RewriteFileSystem struct + FileSystem http.FileSystem + Find *regexp.Regexp + MustMatch bool + Replace string + func (self RewriteFileSystem) Open(name string) (http.File, error) + type SkipFunc func(string) bool + type SshHostKeyCallbackFunc = func(hostname string, remote net.Addr, key ssh.PublicKey) error