inspector

package
v0.0.0-...-134e172 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: GPL-3.0, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LectorSupportedFileTypes = map[string][]string{
	"text/plain":         {".txt", ".md", ".markdown"},
	"text/markdown":      {".md", ".markdown"},
	"text/html":          {".html"},
	"application/pdf":    {".pdf"},
	"application/rtf":    {".rtf"},
	"application/msword": {".doc"},
	"application/vnd.oasis.opendocument.text":                                 {".odt"},
	"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {".docx"},
}

LectorSupportedFileTypes defines the files MIME types and extensions supported by Lector.

Functions

This section is empty.

Types

type FileInspector

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

FileInspector provides methods to validate and retrieve information about a file.

func NewFileInspector

func NewFileInspector(path string) *FileInspector

NewFileInspector creates a new FileInspector instance for the given file path.

func (*FileInspector) GetExtension

func (f *FileInspector) GetExtension() string

GetExtension returns the file extension of the file.

func (*FileInspector) GetMimeType

func (f *FileInspector) GetMimeType() (string, error)

GetMimeType returns the MIME type of the file.

func (*FileInspector) GetPath

func (f *FileInspector) GetPath() string

GetPath returns the current file path that is being inspected.

func (*FileInspector) IsDirectory

func (f *FileInspector) IsDirectory() bool

IsDirectory checks if the path points to a directory.

func (*FileInspector) IsEmpty

func (f *FileInspector) IsEmpty() (bool, error)

IsEmpty checks if the file content is empty.

func (*FileInspector) IsFile

func (f *FileInspector) IsFile() bool

IsFile checks if the path points to a regular file.

func (*FileInspector) IsSupportedByLector

func (f *FileInspector) IsSupportedByLector() (bool, error)

IsSupportedByLector checks if the file is supported by Lector based on both MIME type and extension.

func (*FileInspector) IsValid

func (f *FileInspector) IsValid() bool

IsValid checks if the file/directory path exists.

Jump to

Keyboard shortcuts

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