Documentation ¶
Index ¶
- Variables
- type FileInspector
- func (f *FileInspector) GetExtension() string
- func (f *FileInspector) GetMimeType() (string, error)
- func (f *FileInspector) GetPath() string
- func (f *FileInspector) IsDirectory() bool
- func (f *FileInspector) IsEmpty() (bool, error)
- func (f *FileInspector) IsFile() bool
- func (f *FileInspector) IsSupportedByLector() (bool, error)
- func (f *FileInspector) IsValid() bool
Constants ¶
This section is empty.
Variables ¶
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.