Documentation ¶
Index ¶
Constants ¶
const ( // MimeTypeZip - application/zip MIME type MimeTypeZip = "application/zip" // MaxZipChunkSize - size of the chunks for io.CopyN operation MaxZipChunkSize = 1024 )
Variables ¶
var ErrNotSupportedFile = errors.New("invalid file format")
ErrNotSupportedFile - error representing when a file format is not supported by KICS
Functions ¶
This section is empty.
Types ¶
type FileSystemSourceProvider ¶
type FileSystemSourceProvider struct {
// contains filtered or unexported fields
}
FileSystemSourceProvider provides a path to be scanned and a list of files which will not be scanned
func NewFileSystemSourceProvider ¶
func NewFileSystemSourceProvider(paths, excludes []string) (*FileSystemSourceProvider, error)
NewFileSystemSourceProvider initializes a FileSystemSourceProvider with path and files that will be ignored
func (*FileSystemSourceProvider) AddExcluded ¶ added in v1.2.4
func (s *FileSystemSourceProvider) AddExcluded(excludePaths []string) error
AddExcluded add new excluded files to the File System Source Provider
func (*FileSystemSourceProvider) GetBasePaths ¶ added in v1.3.0
func (s *FileSystemSourceProvider) GetBasePaths() []string
GetBasePaths returns base path of FileSystemSourceProvider
func (*FileSystemSourceProvider) GetSources ¶
func (s *FileSystemSourceProvider) GetSources(ctx context.Context, extensions model.Extensions, sink Sink, resolverSink ResolverSink) error
GetSources tries to open file or directory and execute sink function on it
type ResolverSink ¶
ResolverSink defines a sink function to be passed as reference to functions for resolved files/templates
type SourceProvider ¶
type SourceProvider interface { GetBasePaths() []string GetSources(ctx context.Context, extensions model.Extensions, sink Sink, resolverSink ResolverSink) error }
SourceProvider is the interface that wraps the basic GetSources method. GetBasePath returns base path of FileSystemSourceProvider GetSources receives context, receive ID, extensions supported and a sink function to save sources
type ZipSystemSourceProvider ¶ added in v1.3.4
type ZipSystemSourceProvider struct { // PathExtractionMap - relates temporary dir with original path PathExtractionMap map[string]string }
ZipSystemSourceProvider provides a path extraction map that relates temporary dir with original path
func (*ZipSystemSourceProvider) CheckAndExtractZip ¶ added in v1.3.4
func (z *ZipSystemSourceProvider) CheckAndExtractZip(absPath string) (string, error)
CheckAndExtractZip - verifies if a given absolute path is a zip file and if so extracts its contents to a temporary file