file

package
v0.9.13 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountPagesOfPDF

func CountPagesOfPDF(pdfFileName string) (int, error)

CountPagesOfPDF 确定PDF的页数

func ExportAllImageFromPDF

func ExportAllImageFromPDF(pdfFile string)

func ExportImageFromPDF

func ExportImageFromPDF(pdfFile string, pageNum int)

func GetFileFromCache

func GetFileFromCache(id, filename, queryString string, isCover bool, cachePath string, debug bool) ([]byte, string, error)

GetFileFromCache 从缓存读取文件,加快第二次访问的速度

func GetImageFromPDF

func GetImageFromPDF(pdfFileName string, pageNum int, Debug bool) ([]byte, error)

GetImageFromPDF 从PDF里面取jpeg文件,pageNum从1开始

func GetImageListFromEpubFile

func GetImageListFromEpubFile(epubPath string) (imageList []string, err error)

GetImageListFromEpubFile 根据Epub信息,获取有序的imgSrc列表

func GetPageDimensions

func GetPageDimensions(fileName string) []dim

取得PDF页面分辨率

func GetPictureData

func GetPictureData(option GetPictureDataOption) (imgData []byte, contentType string, err error)

func GetQueryString

func GetQueryString(query url.Values) string

GetQueryString 根据查询参数生成一个排序后的键字符串

func GetSingleFile

func GetSingleFile(filePath, nameInArchive, textEncoding string) ([]byte, error)

GetSingleFile 获取单个文件

func SaveFileToCache

func SaveFileToCache(id, filename string, data []byte, queryString, contentType string, isCover bool, cachePath string, debug bool) error

SaveFileToCache 保存文件到缓存,加快读取速度

func ScanNonUTF8Zip

func ScanNonUTF8Zip(filePath string, textEncoding string) (reader *zip.Reader, err error)

ScanNonUTF8Zip 扫描文件,初始化书籍用

func UnArchiveRar

func UnArchiveRar(filePath string, extractPath string) error

UnArchiveRar 一次性解压 RAR 文件

func UnArchiveZip

func UnArchiveZip(filePath string, extractPath string, textEncoding string) error

UnArchiveZip 一次性解压 ZIP 文件

Types

type Container

type Container struct {
	XMLName   xml.Name `xml:"container"`
	Text      string   `xml:",chardata"`
	Version   string   `xml:"version,attr"`
	Xmlns     string   `xml:"xmlns,attr"`
	Rootfiles struct {
		Text     string `xml:",chardata"`
		Rootfile struct {
			Text      string `xml:",chardata"`
			FullPath  string `xml:"full-path,attr"`
			MediaType string `xml:"media-type,attr"`
		} `xml:"rootfile"`
	} `xml:"rootfiles"`
}

Container 定义结构体、映射xml结构 was generated 2022-12-09 00:41:31 by https://xml-to-go.github.io/ in Ukraine.

type EpubMetadata

type EpubMetadata struct {
	Title     string `xml:"title"`
	Language  string `xml:"language"`
	Creator   string `xml:"creator"`
	Publisher string `xml:"publisher"`
	Date      string `xml:"date"`
	Rights    string `xml:"rights"`
	Series    string `xml:"series"`
}

func GetEpubMetadata

func GetEpubMetadata(epubPath string) (metadata EpubMetadata, err error)

GetEpubMetadata 根据Epub信息,获取书籍详情

type GetPictureDataOption

type GetPictureDataOption struct {
	PictureName      string
	BookIsDir        bool
	BookIsPDF        bool
	BookIsNonUTF8Zip bool
	BookFilePath     string
	Debug            bool
	UseCache         bool
	ResizeWidth      int
	ResizeHeight     int
	ResizeMaxWidth   int
	ResizeMaxHeight  int
	ThumbnailMode    bool
	AutoCrop         int
	Gray             bool
	BlurHash         int
	BlurHashImage    int
}

type Package

type Package struct {
	XMLName          xml.Name `xml:"package"`
	Text             string   `xml:",chardata"`
	Version          string   `xml:"version,attr"`
	UniqueIdentifier string   `xml:"unique-identifier,attr"`
	Xmlns            string   `xml:"xmlns,attr"`
	Metadata         struct {
		Text string `xml:",chardata"`
		Dc   string `xml:"dc,attr"`
		Opf  string `xml:"opf,attr"`
		Meta []struct {
			Text    string `xml:",chardata"`
			Name    string `xml:"name,attr"`
			Content string `xml:"content,attr"`
		} `xml:"meta"`
		Identifier struct {
			Text   string `xml:",chardata"`
			ID     string `xml:"id,attr"`
			Scheme string `xml:"scheme,attr"`
		} `xml:"identifier"`
		Title     string `xml:"title"`
		Language  string `xml:"language"`
		Creator   string `xml:"creator"`
		Publisher string `xml:"publisher"`
		Date      string `xml:"date"`
		Rights    string `xml:"rights"`
		Series    string `xml:"series"`
	} `xml:"metadata"`
	Manifest struct {
		Text string `xml:",chardata"`
		Item []struct {
			Text       string `xml:",chardata"`
			ID         string `xml:"id,attr"`
			Href       string `xml:"href,attr"`
			MediaType  string `xml:"media-type,attr"`
			Properties string `xml:"properties,attr"`
		} `xml:"item"`
	} `xml:"manifest"`
	Spine struct {
		Text    string `xml:",chardata"`
		Toc     string `xml:"toc,attr"`
		Itemref []struct {
			Text  string `xml:",chardata"`
			Idref string `xml:"idref,attr"`
		} `xml:"itemref"`
	} `xml:"spine"`
	Guide struct {
		Text      string `xml:",chardata"`
		Reference struct {
			Text  string `xml:",chardata"`
			Type  string `xml:"type,attr"`
			Href  string `xml:"href,attr"`
			Title string `xml:"title,attr"`
		} `xml:"reference"`
	} `xml:"guide"`
}

Package 定义结构体、映射OPF文件(xml)结构用。 was generated 2022-12-09 00:47:41 by https://xml-to-go.github.io/ in Ukraine.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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