Documentation
¶
Index ¶
- Variables
- type Checksum
- type DirectoryReader
- func (r *DirectoryReader) Checksum(filename string, checksum Checksum) ([]byte, error)
- func (r *DirectoryReader) Close() error
- func (r *DirectoryReader) Files() []string
- func (r *DirectoryReader) Name() string
- func (r *DirectoryReader) Open(filename string) (io.ReadCloser, error)
- func (r *DirectoryReader) Rx() uint64
- func (r *DirectoryReader) Size(filename string) (uint64, uint64, error)
- type DirectoryWriter
- type FileReader
- func (r *FileReader) Checksum(filename string, checksum Checksum) ([]byte, error)
- func (r *FileReader) Close() error
- func (r *FileReader) Files() []string
- func (r *FileReader) Name() string
- func (r *FileReader) Open(filename string) (io.ReadCloser, error)
- func (r *FileReader) Rx() uint64
- func (r *FileReader) Size(filename string) (uint64, uint64, error)
- type FileWriter
- type RarReader
- func (r *RarReader) Checksum(filename string, checksum Checksum) ([]byte, error)
- func (r *RarReader) Close() error
- func (r *RarReader) Files() []string
- func (r *RarReader) Name() string
- func (r *RarReader) Open(filename string) (rc io.ReadCloser, err error)
- func (r *RarReader) Rx() uint64
- func (r *RarReader) Size(filename string) (uint64, uint64, error)
- type Reader
- type SevenZipReader
- func (r *SevenZipReader) Checksum(filename string, checksum Checksum) ([]byte, error)
- func (r *SevenZipReader) Close() error
- func (r *SevenZipReader) Files() []string
- func (r *SevenZipReader) Name() string
- func (r *SevenZipReader) Open(filename string) (io.ReadCloser, error)
- func (r *SevenZipReader) Rx() uint64
- func (r *SevenZipReader) Size(filename string) (uint64, uint64, error)
- type TorrentZipReader
- type TorrentZipWriter
- type Validator
- type Writer
- type ZipReader
- func (r *ZipReader) Checksum(filename string, checksum Checksum) ([]byte, error)
- func (r *ZipReader) Close() error
- func (r *ZipReader) Files() []string
- func (r *ZipReader) Name() string
- func (r *ZipReader) Open(filename string) (io.ReadCloser, error)
- func (r *ZipReader) Rx() uint64
- func (r *ZipReader) Size(filename string) (uint64, uint64, error)
- type ZipWriter
- Bugs
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotTorrentZip is returned if a zip file does not have the // correct archive comment ErrNotTorrentZip = errors.New("not a torrent zip") )
Functions ¶
This section is empty.
Types ¶
type DirectoryReader ¶
type DirectoryReader struct {
// contains filtered or unexported fields
}
DirectoryReader reads a directory and provides access to any regular files contained within. Hidden files, directories and any files not in the immediate directory are inaccessible
func NewDirectoryReader ¶
func NewDirectoryReader(directory string) (*DirectoryReader, error)
NewDirectoryReader returns a new DirectoryReader for the passed directory
func (*DirectoryReader) Checksum ¶
func (r *DirectoryReader) Checksum(filename string, checksum Checksum) ([]byte, error)
Checksum computes the checksum for the passed file
func (*DirectoryReader) Close ¶
func (r *DirectoryReader) Close() error
Close closes access to the underlying file. Any other methods are not guaranteed to work after this has been called
func (*DirectoryReader) Files ¶
func (r *DirectoryReader) Files() []string
Files returns all files accessible by the implementation.
func (*DirectoryReader) Name ¶
func (r *DirectoryReader) Name() string
Name returns the full path to the underlying file
func (*DirectoryReader) Open ¶
func (r *DirectoryReader) Open(filename string) (io.ReadCloser, error)
Open returns an io.ReadCloser for any file listed by the Files method
func (*DirectoryReader) Rx ¶
func (r *DirectoryReader) Rx() uint64
Rx returns the number of bytes read by the implementation
type DirectoryWriter ¶
type DirectoryWriter struct {
// contains filtered or unexported fields
}
DirectoryWriter creates a directory if necessary and then writes new files inside it
func NewDirectoryWriter ¶
func NewDirectoryWriter(directory string) (*DirectoryWriter, error)
NewDirectoryWriter returns a new DirectoryWriter for the passed directory. Any existing files within it are removed
func (*DirectoryWriter) Close ¶
func (w *DirectoryWriter) Close() error
Close closes access to the underlying file. Any other methods are not guaranteed to work after this has been called
func (*DirectoryWriter) Create ¶
func (w *DirectoryWriter) Create(filename string) (io.WriteCloser, error)
Create returns an io.WriteCloser for the requested filename. The ability to create multiple files in parallel rather than sequentially is implementation-dependent
func (*DirectoryWriter) Name ¶
func (w *DirectoryWriter) Name() string
Name returns the full path to the underlying file
func (*DirectoryWriter) Tx ¶
func (w *DirectoryWriter) Tx() uint64
Tx returns the number of bytes written by the implementation
type FileReader ¶
type FileReader struct {
// contains filtered or unexported fields
}
FileReader reads a single regular file and coerces it into looking like an archive containing exactly one file
func NewFileReader ¶
func NewFileReader(filename string) (*FileReader, error)
NewFileReader returns a new FileReader for the passed filename
func (*FileReader) Checksum ¶
func (r *FileReader) Checksum(filename string, checksum Checksum) ([]byte, error)
Checksum computes the checksum for the passed file
func (*FileReader) Close ¶
func (r *FileReader) Close() error
Close closes access to the underlying file. Any other methods are not guaranteed to work after this has been called
func (*FileReader) Files ¶
func (r *FileReader) Files() []string
Files returns all files accessible by the implementation.
func (*FileReader) Name ¶
func (r *FileReader) Name() string
Name returns the full path to the underlying file
func (*FileReader) Open ¶
func (r *FileReader) Open(filename string) (io.ReadCloser, error)
Open returns an io.ReadCloser for any file listed by the Files method
func (*FileReader) Rx ¶
func (r *FileReader) Rx() uint64
Rx returns the number of bytes read by the implementation
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
FileWriter writes a single regular file as if it was an archive containing exactly one file. The one file must match the base name of the target
func NewFileWriter ¶
func NewFileWriter(filename string) (*FileWriter, error)
NewFileWriter returns a new FileWriter for the passed filename
func (*FileWriter) Close ¶
func (w *FileWriter) Close() error
Close closes access to the underlying file. Any other methods are not guaranteed to work after this has been called
func (*FileWriter) Create ¶
func (w *FileWriter) Create(filename string) (io.WriteCloser, error)
Create returns an io.WriteCloser for the requested filename. The ability to create multiple files in parallel rather than sequentially is implementation-dependent
func (*FileWriter) Name ¶
func (w *FileWriter) Name() string
Name returns the full path to the underlying file
func (*FileWriter) Tx ¶
func (w *FileWriter) Tx() uint64
Tx returns the number of bytes written by the implementation
type RarReader ¶
type RarReader struct {
// contains filtered or unexported fields
}
RarReader reads a RAR archive and provides access to any regular files contained within. Hidden files, directories and any files not in the top level are inaccessible. Password-protected archives are not supported
func NewRarReader ¶
NewRarReader returns a new RarReader for the passed filename
func (*RarReader) Checksum ¶
Checksum computes the checksum for the passed file, it will not include any header that might be present
func (*RarReader) Close ¶
Close closes access to the underlying file. Any other methods are not guaranteed to work after this has been called
func (*RarReader) Open ¶
func (r *RarReader) Open(filename string) (rc io.ReadCloser, err error)
Open returns an io.ReadCloser for any file listed by the Files method
type Reader ¶
type Reader interface { // Checksum computes the checksum for the passed file, it will not include any header that might be present Checksum(string, Checksum) ([]byte, error) // Close closes access to the underlying file. Any other methods // are not guaranteed to work after this has been called Close() error // Files returns all files accessible by the implementation. Files() []string // Name returns the full path to the underlying file Name() string // Open returns an io.ReadCloser for any file listed by the Files // method Open(string) (io.ReadCloser, error) // Rx returns the number of bytes read by the implementation Rx() uint64 // Size returns the size of any file listed by the Files method and the size of any header that is present Size(string) (uint64, uint64, error) }
Reader is the interface implemented by all ROM readers
type SevenZipReader ¶
type SevenZipReader struct {
// contains filtered or unexported fields
}
SevenZipReader reads a 7zip archive and provides access to any regular files contained within. Hidden files, directories and any files not in the top level are inaccessible
func NewSevenZipReader ¶
func NewSevenZipReader(filename string) (r *SevenZipReader, err error)
NewSevenZipReader returns a new SevenZipReader for the passed 7zip archive
func (*SevenZipReader) Checksum ¶
func (r *SevenZipReader) Checksum(filename string, checksum Checksum) ([]byte, error)
Checksum computes the checksum for the passed file. CRC values for files that don't have special requirements use the value from the central directory
func (*SevenZipReader) Close ¶
func (r *SevenZipReader) Close() error
Close closes access to the underlying file. Any other methods are not guaranteed to work after this has been called
func (*SevenZipReader) Files ¶
func (r *SevenZipReader) Files() []string
Files returns all files accessible by the implementation.
func (*SevenZipReader) Name ¶
func (r *SevenZipReader) Name() string
Name returns the full path to the underlying file
func (*SevenZipReader) Open ¶
func (r *SevenZipReader) Open(filename string) (io.ReadCloser, error)
Open returns an io.ReadCloser for any file listed by the Files method
func (*SevenZipReader) Rx ¶
func (r *SevenZipReader) Rx() uint64
Rx returns the number of bytes read by the implementation
type TorrentZipReader ¶
type TorrentZipReader struct { *ZipReader // contains filtered or unexported fields }
TorrentZipReader reads a zip archive and provides access to any regular files contained within. Hidden files, directories and any files not in the top level are inaccessible
func NewTorrentZipReader ¶
func NewTorrentZipReader(filename string) (r *TorrentZipReader, err error)
NewTorrentZipReader returns a new TorrentZipReader for the passed zip archive. It extends NewZipReader to check that the zip archive has the correctly formatted comment and validates that the CRC of the central directory matches the comment value
func (*TorrentZipReader) Valid ¶
func (r *TorrentZipReader) Valid() bool
Valid confirms the checksum of the central directory in the zip archive matches the value in the archive comment
type TorrentZipWriter ¶
type TorrentZipWriter struct {
// contains filtered or unexported fields
}
TorrentZipWriter creates a new zip archive using the torrentzip standard. It is slightly slower to create than a normal zip archive
func NewTorrentZipWriter ¶
func NewTorrentZipWriter(filename string) (*TorrentZipWriter, error)
NewTorrentZipWriter returns a new TorrentZipWriter for the passed zip archive
func (*TorrentZipWriter) Close ¶
func (w *TorrentZipWriter) Close() error
Close closes access to the underlying file. Any other methods are not guaranteed to work after this has been called
func (*TorrentZipWriter) Create ¶
func (w *TorrentZipWriter) Create(filename string) (io.WriteCloser, error)
Create returns an io.WriteCloser for the requested filename. The ability to create multiple files in parallel rather than sequentially is implementation-dependent
func (*TorrentZipWriter) Name ¶
func (w *TorrentZipWriter) Name() string
Name returns the full path to the underlying file
func (*TorrentZipWriter) Tx ¶
func (w *TorrentZipWriter) Tx() uint64
Tx returns the number of bytes written by the implementation
type Validator ¶
type Validator interface { // Valid returns if the underlying file or container is considered // correct Valid() bool }
Validator is the interface optionally implemented by a ROM reader if it can validate its integrity somehow
type Writer ¶
type Writer interface { // Close closes access to the underlying file. Any other methods // are not guaranteed to work after this has been called Close() error // Create returns an io.WriteCloser for the requested filename. The // ability to create multiple files in parallel rather than // sequentially is implementation-dependent Create(string) (io.WriteCloser, error) // Name returns the full path to the underlying file Name() string // Tx returns the number of bytes written by the implementation Tx() uint64 }
Writer is the interface implemented by all ROM writers
type ZipReader ¶
type ZipReader struct {
// contains filtered or unexported fields
}
ZipReader reads a zip archive and provides access to any regular files contained within. Hidden files, directories and any files not in the top level are inaccessible
func NewZipReader ¶
NewZipReader returns a new ZipReader for the passed zip archive
func (*ZipReader) Checksum ¶
Checksum computes the checksum for the passed file. CRC values for files that don't have special requirements use the value from the central directory
func (*ZipReader) Close ¶
Close closes access to the underlying file. Any other methods are not guaranteed to work after this has been called
func (*ZipReader) Open ¶
func (r *ZipReader) Open(filename string) (io.ReadCloser, error)
Open returns an io.ReadCloser for any file listed by the Files method
type ZipWriter ¶
type ZipWriter struct {
// contains filtered or unexported fields
}
ZipWriter creates a new zip archive
func NewZipWriter ¶
NewZipWriter returns a new ZipWriter for the passed zip archive
func (*ZipWriter) Close ¶
Close closes access to the underlying file. Any other methods are not guaranteed to work after this has been called
func (*ZipWriter) Create ¶
func (w *ZipWriter) Create(filename string) (io.WriteCloser, error)
Create returns an io.WriteCloser for the requested filename. The ability to create multiple files in parallel rather than sequentially is implementation-dependent
Notes ¶
Bugs ¶
RarReader is not very I/O efficient due to the underlying implementation
The bytes written for TorrentZipWriter is not accurate
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
Package dat implements parsing of XML dat files as commonly used by ROM/Disc preservation projects such as http://redump.org and https://no-intro.org.
|
Package dat implements parsing of XML dat files as commonly used by ROM/Disc preservation projects such as http://redump.org and https://no-intro.org. |
Package synchronizer implements a set of methods to maintain a pristine directory of TorrentZip files representing the games in a dat file.
|
Package synchronizer implements a set of methods to maintain a pristine directory of TorrentZip files representing the games in a dat file. |