Documentation ¶
Index ¶
- Variables
- func AddHandler(handler Handler) error
- func AddHandlers(handlers ...Handler) error
- func Chunk(reader io.Reader, chunkSize int64) ([]byte, error)
- func CtxHttpClient(src *Source) *http.Client
- func GetSha1FromReader(reader io.Reader) (string, error)
- func HasExtFile(path string, extensions ...string) bool
- func IsExecutable(reader io.Reader) bool
- func IsTarFile(path string) bool
- func IsTarGzFile(path string) bool
- func IsWebURL(path string) bool
- func IsZipFile(reader io.Reader) bool
- func IsZipFileExt(path string) bool
- func SetCtxHttpClient(src *Source, client *http.Client)
- func SetHttpClient(httpClient *http.Client)
- type CompressProcessor
- type GitHandler
- type GitUtils
- type Handler
- type HttpHandler
- type LocalHandler
- func (h LocalHandler) Detect(src *Source) bool
- func (h LocalHandler) GetZipSize(zipFile *os.File) (int64, error)
- func (h LocalHandler) Name() string
- func (h LocalHandler) Sha1(src *Source) (string, error)
- func (h LocalHandler) Zip(src *Source) (ZipReadCloser, error)
- func (h LocalHandler) ZipFiles(dirOrZipFilePath string, targetFile *os.File) error
- type Manager
- func (m *Manager) AddHandler(handler Handler) error
- func (m *Manager) AddHandlers(handlers ...Handler) error
- func (m *Manager) CreateSession(path string, handlerNames ...string) (*Session, error)
- func (m *Manager) FindHandler(path string, handlerName string) (Handler, error)
- func (m *Manager) SetHttpClient(httpClient *http.Client)
- type Session
- type Source
- type SourceContextKey
- type ZipFile
- type ZipReadCloser
Constants ¶
This section is empty.
Variables ¶
var BZ2_FILE_EXT []string = []string{
".bz2",
}
var GZIP_FILE_EXT []string = []string{
".gz",
".gzip",
}
var TARGZ_FILE_EXT []string = []string{
".tgz",
}
var TAR_FILE_EXT []string = []string{
".tar",
}
var ZIP_FILE_EXT []string = []string{
".zip",
".jar",
".war",
}
Functions ¶
func CtxHttpClient ¶
Retrieve http client set in context This could be use for a zip handler
func GetSha1FromReader ¶
Create sha1 from a reader by loading in maximum 5kb
func HasExtFile ¶
check if file has one if extensions given
func SetCtxHttpClient ¶
Set http client in the context of a source This could be use for a zip handler
Types ¶
type CompressProcessor ¶ added in v1.2.0
type CompressProcessor struct {
// contains filtered or unexported fields
}
func NewCompressProcessor ¶ added in v1.2.0
func NewCompressProcessor(src *Source, readCloserFunc readCloserFunc) *CompressProcessor
func (CompressProcessor) ToZip ¶ added in v1.2.0
func (p CompressProcessor) ToZip() (ZipReadCloser, error)
type GitHandler ¶
type GitHandler struct {
// contains filtered or unexported fields
}
func NewGitHandler ¶
func NewGitHandler() *GitHandler
func (GitHandler) Detect ¶
func (h GitHandler) Detect(src *Source) bool
func (GitHandler) Name ¶
func (h GitHandler) Name() string
func (GitHandler) Zip ¶
func (h GitHandler) Zip(src *Source) (ZipReadCloser, error)
type GitUtils ¶
type GitUtils struct { Folder string Url string RefName string AuthMethod transport.AuthMethod SubPath string }
func (GitUtils) CommitSha1 ¶
type Handler ¶
type HttpHandler ¶
type HttpHandler struct { }
func (HttpHandler) Detect ¶
func (h HttpHandler) Detect(src *Source) bool
func (HttpHandler) Name ¶
func (h HttpHandler) Name() string
func (HttpHandler) Zip ¶
func (h HttpHandler) Zip(src *Source) (ZipReadCloser, error)
type LocalHandler ¶
type LocalHandler struct { }
func (LocalHandler) Detect ¶
func (h LocalHandler) Detect(src *Source) bool
func (LocalHandler) GetZipSize ¶
func (h LocalHandler) GetZipSize(zipFile *os.File) (int64, error)
func (LocalHandler) Name ¶
func (h LocalHandler) Name() string
func (LocalHandler) Zip ¶
func (h LocalHandler) Zip(src *Source) (ZipReadCloser, error)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
Create new manager with given zip handlers
func (*Manager) AddHandler ¶
Add new zip handler to manager
func (*Manager) AddHandlers ¶
Add new zip handlers to manager
func (*Manager) CreateSession ¶
Create a session for a given path with given handler type. Omitting handler type will use auto detection)
func (*Manager) FindHandler ¶
Find zip handler by its type if type is empty string this will use auto-detection
func (*Manager) SetHttpClient ¶
Set a custom http client for zip handlers which need it
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func CreateSession ¶
For default manager
Create a session for a given path with given handler type. Omitting handler type will use auto detection)
type Source ¶
type Source struct { // Path for zip handler Path string // contains filtered or unexported fields }
func (*Source) Context ¶
Context returns the request's context. To change the context, use WithContext.
The returned context is always non-nil; it defaults to the background context.
For outgoing client requests, the context controls cancelation.
For incoming server requests, the context is canceled when the client's connection closes, the request is canceled (with HTTP/2), or when the ServeHTTP method returns.
type SourceContextKey ¶
type SourceContextKey int
const (
HttpClientContextKey SourceContextKey = iota
)
type ZipFile ¶
type ZipFile struct {
// contains filtered or unexported fields
}
func NewZipFile ¶
func NewZipFile(file io.ReadCloser, size int64, clean func() error) *ZipFile
Create a new ZipFile
type ZipReadCloser ¶
type ZipReadCloser interface { io.ReadCloser Size() int64 }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cli
|
|
come from
|
come from |
Code generated by counterfeiter.
|
Code generated by counterfeiter. |