parser

package
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2025 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const FeaturePDFEnabled = false

Variables

View Source
var ErrBadFile = errors.New("bad file or corrupted")
View Source
var ErrParserDisabled = errors.New("parser disabled")

Functions

This section is empty.

Types

type BMPParser

type BMPParser struct {
	// contains filtered or unexported fields
}

Parses `image/bmp` files

func NewBMPParser

func NewBMPParser(ocrProvider ocr.Provider) *BMPParser

func (*BMPParser) Parse

func (p *BMPParser) Parse(ctx context.Context, file io.Reader, path string) Result

func (*BMPParser) ParseStream added in v0.0.10

func (p *BMPParser) ParseStream(ctx context.Context, file io.Reader, path string) chan StreamResult

func (*BMPParser) SupportedMimeTypes

func (p *BMPParser) SupportedMimeTypes() []string

type BMPParserResult

type BMPParserResult struct {
	FullPath string `json:"path"`
	Text     string `json:"text"`
	Err      error  `json:"error"`
}

func (*BMPParserResult) Error

func (r *BMPParserResult) Error() error

func (*BMPParserResult) Path added in v0.0.10

func (r *BMPParserResult) Path() string

func (*BMPParserResult) String

func (r *BMPParserResult) String() string

func (*BMPParserResult) Subfiles added in v0.0.10

func (r *BMPParserResult) Subfiles() []Result

type BMPParserStreamResult added in v0.0.10

type BMPParserStreamResult struct {
	FullPath        string             `json:"path"`
	Text            string             `json:"text"`
	CurrentStage    ParseProgressStage `json:"stage"`
	CurrentProgress uint8              `json:"progress"`
	Err             error              `json:"error"`
}

func (*BMPParserStreamResult) Error added in v0.0.10

func (r *BMPParserStreamResult) Error() error

func (*BMPParserStreamResult) Path added in v0.0.10

func (r *BMPParserStreamResult) Path() string

func (*BMPParserStreamResult) Progress added in v0.0.10

func (r *BMPParserStreamResult) Progress() uint8

func (*BMPParserStreamResult) Stage added in v0.0.10

func (*BMPParserStreamResult) String added in v0.0.10

func (r *BMPParserStreamResult) String() string

func (*BMPParserStreamResult) SubResult added in v0.0.10

func (r *BMPParserStreamResult) SubResult() StreamResult

type CompositeParser

type CompositeParser struct {
	// contains filtered or unexported fields
}

func NewCompositeParser

func NewCompositeParser(parsers ...Parser) *CompositeParser

func (*CompositeParser) AddParsers

func (p *CompositeParser) AddParsers(parsers ...Parser)

func (*CompositeParser) Parse

func (p *CompositeParser) Parse(ctx context.Context, file io.Reader, path string) Result

func (*CompositeParser) ParseStream added in v0.0.10

func (p *CompositeParser) ParseStream(ctx context.Context, file io.Reader, path string) chan StreamResult

func (*CompositeParser) SupportedMimeTypes

func (p *CompositeParser) SupportedMimeTypes() []string

type CompositeParserResult

type CompositeParserResult struct {
	FullPath string `json:"path"`
	Err      error  `json:"error"`
	MimeType string `json:"mimeType"`
	Inner    Result `json:"inner"`
}

func (*CompositeParserResult) Error

func (r *CompositeParserResult) Error() error

func (*CompositeParserResult) Path added in v0.0.10

func (r *CompositeParserResult) Path() string

func (*CompositeParserResult) String

func (r *CompositeParserResult) String() string

func (*CompositeParserResult) Subfiles added in v0.0.10

func (r *CompositeParserResult) Subfiles() []Result

type CompositeParserStreamResult added in v0.0.10

type CompositeParserStreamResult struct {
	FullPath        string             `json:"path"`
	Text            string             `json:"text"`
	MimeType        string             `json:"mimeType"`
	Inner           StreamResult       `json:"inner"`
	CurrentStage    ParseProgressStage `json:"stage"`
	CurrentProgress uint8              `json:"progress"`
	Err             error              `json:"error"`
}

func (*CompositeParserStreamResult) Error added in v0.0.10

func (*CompositeParserStreamResult) Path added in v0.0.10

func (*CompositeParserStreamResult) Progress added in v0.0.10

func (r *CompositeParserStreamResult) Progress() uint8

func (*CompositeParserStreamResult) Stage added in v0.0.10

func (*CompositeParserStreamResult) String added in v0.0.10

func (r *CompositeParserStreamResult) String() string

func (*CompositeParserStreamResult) SubResult added in v0.0.10

type EMLParser added in v0.0.10

type EMLParser struct {
	// contains filtered or unexported fields
}

Parses `message/rfc822` files (.eml)

func NewEMLParser added in v0.0.10

func NewEMLParser(innerParser Parser) *EMLParser

func (*EMLParser) Parse added in v0.0.10

func (p *EMLParser) Parse(ctx context.Context, file io.Reader, path string) Result

func (*EMLParser) ParseStream added in v0.0.10

func (p *EMLParser) ParseStream(ctx context.Context, file io.Reader, path string) chan StreamResult

func (*EMLParser) SupportedMimeTypes added in v0.0.10

func (p *EMLParser) SupportedMimeTypes() []string

type EMLParserResult added in v0.0.10

type EMLParserResult struct {
	FullPath    string              `json:"path"`
	Headers     map[string][]string `json:"headers"`
	Text        string              `json:"text"`
	Err         error               `json:"error"`
	Attachments []Result            `json:"attachments"`
}

func (*EMLParserResult) Error added in v0.0.10

func (r *EMLParserResult) Error() error

func (*EMLParserResult) Path added in v0.0.10

func (r *EMLParserResult) Path() string

func (*EMLParserResult) String added in v0.0.10

func (r *EMLParserResult) String() string

func (*EMLParserResult) Subfiles added in v0.0.10

func (r *EMLParserResult) Subfiles() []Result

type EMLParserStreamResult added in v0.0.10

type EMLParserStreamResult struct {
	FullPath          string             `json:"path"`
	Text              string             `json:"text"`
	CurrentStage      ParseProgressStage `json:"stage"`
	CurrentPartHeader mail.PartHeader    `json:"subResultHeader"`
	CurrentPart       StreamResult       `json:"subResult"`
	Err               error              `json:"error"`
}

func (*EMLParserStreamResult) Error added in v0.0.10

func (r *EMLParserStreamResult) Error() error

func (*EMLParserStreamResult) Path added in v0.0.10

func (r *EMLParserStreamResult) Path() string

func (*EMLParserStreamResult) Progress added in v0.0.10

func (r *EMLParserStreamResult) Progress() uint8

func (*EMLParserStreamResult) Stage added in v0.0.10

func (*EMLParserStreamResult) String added in v0.0.10

func (r *EMLParserStreamResult) String() string

func (*EMLParserStreamResult) SubResult added in v0.0.10

func (r *EMLParserStreamResult) SubResult() StreamResult

type ErrMimeTypeNotSupported

type ErrMimeTypeNotSupported struct {
	MimeType *mimetype.MIME
}

func (*ErrMimeTypeNotSupported) Error

func (e *ErrMimeTypeNotSupported) Error() string

type GIFParser

type GIFParser struct {
	// contains filtered or unexported fields
}

Parses `image/gif` files. Only decodes first frame

func NewGIFParser

func NewGIFParser(ocrProvider ocr.Provider) *GIFParser

func (*GIFParser) Parse

func (p *GIFParser) Parse(ctx context.Context, file io.Reader, path string) Result

func (*GIFParser) ParseStream added in v0.0.10

func (p *GIFParser) ParseStream(ctx context.Context, file io.Reader, path string) chan StreamResult

func (*GIFParser) SupportedMimeTypes

func (p *GIFParser) SupportedMimeTypes() []string

type GIFParserResult

type GIFParserResult struct {
	FullPath string `json:"path"`
	Text     string `json:"text"`
	Err      error  `json:"error"`
}

func (*GIFParserResult) Error

func (r *GIFParserResult) Error() error

func (*GIFParserResult) Path added in v0.0.10

func (r *GIFParserResult) Path() string

func (*GIFParserResult) String

func (r *GIFParserResult) String() string

func (*GIFParserResult) Subfiles added in v0.0.10

func (r *GIFParserResult) Subfiles() []Result

type GIFParserStreamResult added in v0.0.10

type GIFParserStreamResult struct {
	FullPath        string             `json:"path"`
	Text            string             `json:"text"`
	CurrentStage    ParseProgressStage `json:"stage"`
	CurrentProgress uint8              `json:"progress"`
	Err             error              `json:"error"`
}

func (*GIFParserStreamResult) Error added in v0.0.10

func (r *GIFParserStreamResult) Error() error

func (*GIFParserStreamResult) Path added in v0.0.10

func (r *GIFParserStreamResult) Path() string

func (*GIFParserStreamResult) Progress added in v0.0.10

func (r *GIFParserStreamResult) Progress() uint8

func (*GIFParserStreamResult) Stage added in v0.0.10

func (*GIFParserStreamResult) String added in v0.0.10

func (r *GIFParserStreamResult) String() string

func (*GIFParserStreamResult) SubResult added in v0.0.10

func (r *GIFParserStreamResult) SubResult() StreamResult

type JPEGParser

type JPEGParser struct {
	// contains filtered or unexported fields
}

Parses `image/jpeg` files

func NewJPEGParser

func NewJPEGParser(ocrProvider ocr.Provider) *JPEGParser

func (*JPEGParser) Parse

func (p *JPEGParser) Parse(ctx context.Context, file io.Reader, path string) Result

func (*JPEGParser) ParseStream added in v0.0.10

func (p *JPEGParser) ParseStream(ctx context.Context, file io.Reader, path string) chan StreamResult

func (*JPEGParser) SupportedMimeTypes

func (p *JPEGParser) SupportedMimeTypes() []string

type JPEGParserResult

type JPEGParserResult struct {
	FullPath string `json:"path"`
	Text     string `json:"text"`
	Err      error  `json:"error"`
}

func (*JPEGParserResult) Error

func (r *JPEGParserResult) Error() error

func (*JPEGParserResult) Path added in v0.0.10

func (r *JPEGParserResult) Path() string

func (*JPEGParserResult) String

func (r *JPEGParserResult) String() string

func (*JPEGParserResult) Subfiles added in v0.0.10

func (r *JPEGParserResult) Subfiles() []Result

type JPEGParserStreamResult added in v0.0.10

type JPEGParserStreamResult struct {
	FullPath        string             `json:"path"`
	Text            string             `json:"text"`
	CurrentStage    ParseProgressStage `json:"stage"`
	CurrentProgress uint8              `json:"progress"`
	Err             error              `json:"error"`
}

func (*JPEGParserStreamResult) Error added in v0.0.10

func (r *JPEGParserStreamResult) Error() error

func (*JPEGParserStreamResult) Path added in v0.0.10

func (r *JPEGParserStreamResult) Path() string

func (*JPEGParserStreamResult) Progress added in v0.0.10

func (r *JPEGParserStreamResult) Progress() uint8

func (*JPEGParserStreamResult) Stage added in v0.0.10

func (*JPEGParserStreamResult) String added in v0.0.10

func (r *JPEGParserStreamResult) String() string

func (*JPEGParserStreamResult) SubResult added in v0.0.10

func (r *JPEGParserStreamResult) SubResult() StreamResult

type PDFParser

type PDFParser struct {
}

Parses `application/pdf` files

func NewPDFParser

func NewPDFParser(innerParser Parser) *PDFParser

func (*PDFParser) Parse

func (p *PDFParser) Parse(ctx context.Context, file io.Reader, path string) Result

func (*PDFParser) ParseStream added in v0.0.10

func (p *PDFParser) ParseStream(ctx context.Context, file io.Reader, path string) chan StreamResult

func (*PDFParser) SupportedMimeTypes

func (p *PDFParser) SupportedMimeTypes() []string

type PDFParserResult

type PDFParserResult struct {
	Metadata string                `json:"metadata"`
	Pages    []PDFParserResultPage `json:"pages"`
	Err      error                 `json:"error"`
}

func (*PDFParserResult) Error

func (r *PDFParserResult) Error() error

func (*PDFParserResult) Path added in v0.0.10

func (r *PDFParserResult) Path() string

func (*PDFParserResult) String

func (r *PDFParserResult) String() string

func (*PDFParserResult) Subfiles added in v0.0.10

func (r *PDFParserResult) Subfiles() []Result

type PDFParserResultPage

type PDFParserResultPage struct {
	Text   string   `json:"text"`
	Images []Result `json:"images"`
}

type PDFParserStreamResult added in v0.0.10

type PDFParserStreamResult struct {
	FullPath        string                      `json:"path"`
	Text            string                      `json:"text"`
	CurrentStage    ParseProgressStage          `json:"stage"`
	CurrentProgress uint8                       `json:"progress"`
	Metadata        string                      `json:"metadata"`
	Pages           []PDFParserStreamResultPage `json:"pages"`
	Subfile         StreamResult                `json:"subfile"`
	Err             error                       `json:"error"`
}

func (*PDFParserStreamResult) Error added in v0.0.10

func (r *PDFParserStreamResult) Error() error

func (*PDFParserStreamResult) Path added in v0.0.10

func (r *PDFParserStreamResult) Path() string

func (*PDFParserStreamResult) Progress added in v0.0.10

func (r *PDFParserStreamResult) Progress() uint8

func (*PDFParserStreamResult) Stage added in v0.0.10

func (*PDFParserStreamResult) String added in v0.0.10

func (r *PDFParserStreamResult) String() string

func (*PDFParserStreamResult) SubResult added in v0.0.10

func (r *PDFParserStreamResult) SubResult() StreamResult

type PDFParserStreamResultPage added in v0.0.10

type PDFParserStreamResultPage struct {
	Text   string         `json:"text"`
	Images []StreamResult `json:"images"`
}

type PNGParser

type PNGParser struct {
	// contains filtered or unexported fields
}

Parses `image/png` files

func NewPNGParser

func NewPNGParser(ocrProvider ocr.Provider) *PNGParser

func (*PNGParser) Parse

func (p *PNGParser) Parse(ctx context.Context, file io.Reader, path string) Result

func (*PNGParser) ParseStream added in v0.0.10

func (p *PNGParser) ParseStream(ctx context.Context, file io.Reader, path string) chan StreamResult

func (*PNGParser) SupportedMimeTypes

func (p *PNGParser) SupportedMimeTypes() []string

type PNGParserResult

type PNGParserResult struct {
	FullPath string `json:"path"`
	Text     string `json:"text"`
	Err      error  `json:"error"`
}

func (*PNGParserResult) Error

func (r *PNGParserResult) Error() error

func (*PNGParserResult) Path added in v0.0.10

func (r *PNGParserResult) Path() string

func (*PNGParserResult) String

func (r *PNGParserResult) String() string

func (*PNGParserResult) Subfiles added in v0.0.10

func (r *PNGParserResult) Subfiles() []Result

type PNGParserStreamResult added in v0.0.10

type PNGParserStreamResult struct {
	FullPath        string             `json:"path"`
	Text            string             `json:"text"`
	CurrentStage    ParseProgressStage `json:"stage"`
	CurrentProgress uint8              `json:"progress"`
	Err             error              `json:"error"`
}

func (*PNGParserStreamResult) Error added in v0.0.10

func (r *PNGParserStreamResult) Error() error

func (*PNGParserStreamResult) Path added in v0.0.10

func (r *PNGParserStreamResult) Path() string

func (*PNGParserStreamResult) Progress added in v0.0.10

func (r *PNGParserStreamResult) Progress() uint8

func (*PNGParserStreamResult) Stage added in v0.0.10

func (*PNGParserStreamResult) String added in v0.0.10

func (r *PNGParserStreamResult) String() string

func (*PNGParserStreamResult) SubResult added in v0.0.10

func (r *PNGParserStreamResult) SubResult() StreamResult

type ParseProgressStage added in v0.0.10

type ParseProgressStage string
const ProgressCompleted ParseProgressStage = "COMPLETED"

Raises on the end of file parsing

const ProgressNew ParseProgressStage = "NEW"
const ProgressUpdate ParseProgressStage = "UPDATE"

Indicates that

type Parser

type Parser interface {
	// Returns list of supported mime types by this parser
	SupportedMimeTypes() []string
	// Parse file. Thread safe. Use path to track subfiles or use file name as hint for mime type detection.
	Parse(ctx context.Context, file io.Reader, path string) Result
	// Parse file. Thread safe. Use path to track subfiles or use file name as hint for mime type detection. Return chanel that streams results.
	ParseStream(ctx context.Context, file io.Reader, path string) chan StreamResult
}

func New

func New(ocrProvider ocr.Provider) Parser

Build parser with all possible file types included

type RAWBGRAParser added in v0.0.8

type RAWBGRAParser struct {
	// contains filtered or unexported fields
}

Parses internal `image/file2llm-raw-bgra` streams

func NewRAWBGRAParser added in v0.0.8

func NewRAWBGRAParser(ocrProvider ocr.Provider) *RAWBGRAParser

func (*RAWBGRAParser) Parse added in v0.0.8

func (p *RAWBGRAParser) Parse(ctx context.Context, file io.Reader, path string) Result

func (*RAWBGRAParser) ParseStream added in v0.0.10

func (p *RAWBGRAParser) ParseStream(ctx context.Context, file io.Reader, path string) chan StreamResult

func (*RAWBGRAParser) SupportedMimeTypes added in v0.0.8

func (p *RAWBGRAParser) SupportedMimeTypes() []string

type RAWBGRAParserResult added in v0.0.8

type RAWBGRAParserResult struct {
	FullPath string `json:"path"`
	Text     string `json:"text"`
	Err      error  `json:"error"`
}

func (*RAWBGRAParserResult) Error added in v0.0.8

func (r *RAWBGRAParserResult) Error() error

func (*RAWBGRAParserResult) Path added in v0.0.10

func (r *RAWBGRAParserResult) Path() string

func (*RAWBGRAParserResult) String added in v0.0.8

func (r *RAWBGRAParserResult) String() string

func (*RAWBGRAParserResult) Subfiles added in v0.0.10

func (r *RAWBGRAParserResult) Subfiles() []Result

type RAWBGRAParserStreamResult added in v0.0.10

type RAWBGRAParserStreamResult struct {
	FullPath        string             `json:"path"`
	Text            string             `json:"text"`
	CurrentStage    ParseProgressStage `json:"stage"`
	CurrentProgress uint8              `json:"progress"`
	Err             error              `json:"error"`
}

func (*RAWBGRAParserStreamResult) Error added in v0.0.10

func (r *RAWBGRAParserStreamResult) Error() error

func (*RAWBGRAParserStreamResult) Path added in v0.0.10

func (*RAWBGRAParserStreamResult) Progress added in v0.0.10

func (r *RAWBGRAParserStreamResult) Progress() uint8

func (*RAWBGRAParserStreamResult) Stage added in v0.0.10

func (*RAWBGRAParserStreamResult) String added in v0.0.10

func (r *RAWBGRAParserStreamResult) String() string

func (*RAWBGRAParserStreamResult) SubResult added in v0.0.10

func (r *RAWBGRAParserStreamResult) SubResult() StreamResult

type Result

type Result interface {
	// Get full path to the file
	Path() string
	// Convert entire result to LLM readable string
	String() string
	// Not empty if there where error
	Error() error
	// Parsed subfiles. For example files inside archives
	Subfiles() []Result
}

Parsing result

type StreamResult added in v0.0.10

type StreamResult interface {
	// Get full path to the file
	Path() string
	// Current file processing progress
	Stage() ParseProgressStage
	// Progress in percents from 0 to 100
	Progress() uint8
	// Underlying result
	SubResult() StreamResult
	// Convert entire result to LLM readable string
	String() string
	// Not empty if there where error
	Error() error
}

type TARParser added in v0.0.10

type TARParser struct {
	// contains filtered or unexported fields
}

func NewTARParser added in v0.0.10

func NewTARParser(innerParser Parser) *TARParser

func (*TARParser) Parse added in v0.0.10

func (p *TARParser) Parse(ctx context.Context, file io.Reader, path string) Result

func (*TARParser) ParseStream added in v0.0.10

func (p *TARParser) ParseStream(ctx context.Context, file io.Reader, path string) chan StreamResult

func (*TARParser) SupportedMimeTypes added in v0.0.10

func (p *TARParser) SupportedMimeTypes() []string

type TARParserResult added in v0.0.10

type TARParserResult struct {
	FullPath        string   `json:"path"`
	SubfilesResults []Result `json:"subfiles"`
	Err             error    `json:"error"`
}

func (*TARParserResult) Error added in v0.0.10

func (r *TARParserResult) Error() error

func (*TARParserResult) Path added in v0.0.10

func (r *TARParserResult) Path() string

func (*TARParserResult) String added in v0.0.10

func (r *TARParserResult) String() string

func (*TARParserResult) Subfiles added in v0.0.10

func (r *TARParserResult) Subfiles() []Result

type TARParserStreamResult added in v0.0.10

type TARParserStreamResult struct {
	FullPath       string             `json:"path"`
	CurrentStage   ParseProgressStage `json:"stage"`
	CurrentSubfile StreamResult       `json:"subResult"`
	Err            error              `json:"error"`
}

func (*TARParserStreamResult) Error added in v0.0.10

func (r *TARParserStreamResult) Error() error

func (*TARParserStreamResult) Path added in v0.0.10

func (r *TARParserStreamResult) Path() string

func (*TARParserStreamResult) Progress added in v0.0.10

func (r *TARParserStreamResult) Progress() uint8

func (*TARParserStreamResult) Stage added in v0.0.10

func (*TARParserStreamResult) String added in v0.0.10

func (r *TARParserStreamResult) String() string

func (*TARParserStreamResult) SubResult added in v0.0.10

func (r *TARParserStreamResult) SubResult() StreamResult

type TIFFParserStreamResult added in v0.0.10

type TIFFParserStreamResult struct {
	FullPath        string             `json:"path"`
	Text            string             `json:"text"`
	CurrentStage    ParseProgressStage `json:"stage"`
	CurrentProgress uint8              `json:"progress"`
	Err             error              `json:"error"`
}

func (*TIFFParserStreamResult) Error added in v0.0.10

func (r *TIFFParserStreamResult) Error() error

func (*TIFFParserStreamResult) Path added in v0.0.10

func (r *TIFFParserStreamResult) Path() string

func (*TIFFParserStreamResult) Progress added in v0.0.10

func (r *TIFFParserStreamResult) Progress() uint8

func (*TIFFParserStreamResult) Stage added in v0.0.10

func (*TIFFParserStreamResult) String added in v0.0.10

func (r *TIFFParserStreamResult) String() string

func (*TIFFParserStreamResult) SubResult added in v0.0.10

func (r *TIFFParserStreamResult) SubResult() StreamResult

type TiffParser

type TiffParser struct {
	// contains filtered or unexported fields
}

Parses `image/tiff` files

func NewTiffParser

func NewTiffParser(ocrProvider ocr.Provider) *TiffParser

func (*TiffParser) Parse

func (p *TiffParser) Parse(ctx context.Context, file io.Reader, path string) Result

func (*TiffParser) ParseStream added in v0.0.10

func (p *TiffParser) ParseStream(ctx context.Context, file io.Reader, path string) chan StreamResult

func (*TiffParser) SupportedMimeTypes

func (p *TiffParser) SupportedMimeTypes() []string

type TiffParserResult

type TiffParserResult struct {
	FullPath string `json:"path"`
	Text     string `json:"text"`
	Err      error  `json:"error"`
}

func (*TiffParserResult) Error

func (r *TiffParserResult) Error() error

func (*TiffParserResult) Path added in v0.0.10

func (r *TiffParserResult) Path() string

func (*TiffParserResult) String

func (r *TiffParserResult) String() string

func (*TiffParserResult) Subfiles added in v0.0.10

func (r *TiffParserResult) Subfiles() []Result

type WEBPParserStreamResult added in v0.0.10

type WEBPParserStreamResult struct {
	FullPath        string             `json:"path"`
	Text            string             `json:"text"`
	CurrentStage    ParseProgressStage `json:"stage"`
	CurrentProgress uint8              `json:"progress"`
	Err             error              `json:"error"`
}

func (*WEBPParserStreamResult) Error added in v0.0.10

func (r *WEBPParserStreamResult) Error() error

func (*WEBPParserStreamResult) Path added in v0.0.10

func (r *WEBPParserStreamResult) Path() string

func (*WEBPParserStreamResult) Progress added in v0.0.10

func (r *WEBPParserStreamResult) Progress() uint8

func (*WEBPParserStreamResult) Stage added in v0.0.10

func (*WEBPParserStreamResult) String added in v0.0.10

func (r *WEBPParserStreamResult) String() string

func (*WEBPParserStreamResult) SubResult added in v0.0.10

func (r *WEBPParserStreamResult) SubResult() StreamResult

type WebPParser

type WebPParser struct {
	// contains filtered or unexported fields
}

Parses `image/webp` files

func NewWebPParser

func NewWebPParser(ocrProvider ocr.Provider) *WebPParser

func (*WebPParser) Parse

func (p *WebPParser) Parse(ctx context.Context, file io.Reader, path string) Result

func (*WebPParser) ParseStream added in v0.0.10

func (p *WebPParser) ParseStream(ctx context.Context, file io.Reader, path string) chan StreamResult

func (*WebPParser) SupportedMimeTypes

func (p *WebPParser) SupportedMimeTypes() []string

type WebPParserResult

type WebPParserResult struct {
	FullPath string `json:"path"`
	Text     string `json:"text"`
	Err      error  `json:"error"`
}

func (*WebPParserResult) Error

func (r *WebPParserResult) Error() error

func (*WebPParserResult) Path added in v0.0.10

func (r *WebPParserResult) Path() string

func (*WebPParserResult) String

func (r *WebPParserResult) String() string

func (*WebPParserResult) Subfiles added in v0.0.10

func (r *WebPParserResult) Subfiles() []Result

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL