Documentation ¶
Index ¶
- Constants
- func BuildRPFFromLPF(lpfPath string, rwppPath string) error
- func BuildRPFFromPDF(title string, inputPath string, outputPath string) error
- func Do(encrypter crypto.Encrypter, ep epub.Epub, w io.Writer) (enc *xmlenc.Manifest, key crypto.ContentKey, err error)
- func FindFile(name string, ep epub.Epub) (*epub.Resource, bool)
- func Process(encrypter crypto.Encrypter, reader PackageReader, writer PackageWriter) (key crypto.ContentKey, err error)
- func UnzipToFolder(src string, dest string) ([]string, error)
- type EncryptedFileInfo
- type ManualSource
- type NopWriteCloser
- type PackageReader
- type PackageWriter
- type Packager
- type RPFReader
- type RPFWriter
- type Resource
- type Result
- type Source
- type Task
Constants ¶
const ( NoCompression = 0 Deflate = 8 )
NoCompression means Store
const ManifestLocation = "manifest.json"
ManifestLocation is the path if the Readium manifest in a package
const RWPManifestName = "manifest.json"
RWPManifestName is the name of the Readium Manifest in a package
const W3CEntryPageName = "index.html"
W3CEntryPageName is the name of the W3C entry page in an LPF package
const W3CManifestName = "publication.json"
W3CManifestName is the name of the W3C manifest in an LPF package
Variables ¶
This section is empty.
Functions ¶
func BuildRPFFromLPF ¶
BuildRPFFromLPF builds a Readium package (rwpp) from a W3C LPF file (lpfPath)
func BuildRPFFromPDF ¶
BuildRPFFromPDF builds a Readium Package (rwpp) which embeds a PDF file
func Do ¶
func Do(encrypter crypto.Encrypter, ep epub.Epub, w io.Writer) (enc *xmlenc.Manifest, key crypto.ContentKey, err error)
Do encrypts when necessary the resources of an EPUB package It is called for EPUB files only FIXME: try to merge Process() and Do()
func Process ¶
func Process(encrypter crypto.Encrypter, reader PackageReader, writer PackageWriter) (key crypto.ContentKey, err error)
Process copies resources from the source to the destination package, after encryption if needed.
Types ¶
type EncryptedFileInfo ¶
EncryptedFileInfo contains a file, its size and sha256
type ManualSource ¶
type ManualSource struct {
// contains filtered or unexported fields
}
ManualSource is a struc
type NopWriteCloser ¶
NopWriteCloser object
func (*NopWriteCloser) Close ¶
func (nc *NopWriteCloser) Close() error
Close closes a NopWriteCloser
type PackageReader ¶
type PackageReader interface { Resources() []Resource NewWriter(io.Writer) (PackageWriter, error) }
PackageReader is an interface
type PackageWriter ¶
type PackageWriter interface { NewFile(path string, contentType string, storageMethod uint16) (io.WriteCloser, error) MarkAsEncrypted(path string, originalSize int64, algorithm string) Close() error }
PackageWriter is an interface
type Packager ¶
type Packager struct { Incoming chan *Task // contains filtered or unexported fields }
Packager is a struct
type RPFReader ¶
type RPFReader struct {
// contains filtered or unexported fields
}
RPFReader is a Readium Package reader
func NewRPFReader ¶
NewRPFReader creates a new Readium Package reader
func (*RPFReader) NewWriter ¶
func (reader *RPFReader) NewWriter(writer io.Writer) (PackageWriter, error)
NewWriter returns a new PackageWriter writing a RWP to the output file
func (*RPFReader) Resources ¶
Resources returns a list of all resources which may be encrypted It is part of the PackageReader interface. Note: the current design choice is to leave ancillary resources (in "resources" and "alternates") unencrypted FIXME: add "resources" and "alternates" to the slice
type RPFWriter ¶
type RPFWriter struct {
// contains filtered or unexported fields
}
RPFWriter is a Readium Package writer
func (*RPFWriter) MarkAsEncrypted ¶
MarkAsEncrypted marks a resource as encrypted (with an algorithm), in the writer manifest FIXME: currently only looks into the reading order. Add "alternates", think about adding "resources" FIXME: process resources which are compressed before encryption -> add Compression and OriginalLength properties in this case
func (*RPFWriter) NewFile ¶
func (writer *RPFWriter) NewFile(path string, contentType string, storageMethod uint16) (io.WriteCloser, error)
NewFile creates a header in the zip archive and adds an entry to the writer reading order if missing. This function is called in two main cases: - one is the creation of a Readium Package for a PDF file (no existing entry in the manifest) - another in the encryption of an existing Readium Package (there is already an entry in the manifest) FIXME: the PackageWriter interface is obscure; let's make it better.
type Resource ¶
type Resource interface { Path() string Size() int64 ContentType() string CompressBeforeEncryption() bool CanBeEncrypted() bool Encrypted() bool CopyTo(PackageWriter) error Open() (io.ReadCloser, error) }
Resource is an interface