Documentation ¶
Index ¶
- func AtomicDownload(link, filename string) error
- func LoadSet(r io.Reader, m map[string]struct{}) error
- func ReadLines(filename string) (lines []string, err error)
- func SetFromFilename(filename string, m map[string]struct{}) error
- func UserHomeDir() string
- type CountReader
- type FileReader
- type LinkReader
- type SavedLink
- type SavedReaders
- type SkipReader
- type WriteCounter
- type ZipContentReader
- type ZipOrPlainLinkReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicDownload ¶
AtomicDownload retrieves a link and saves its content atomically in filename. TODO(martin): should live in an io related package.
func SetFromFilename ¶
SetFromFilename fills an initialized map as set with items from line in filename, with newlines stripped.
func UserHomeDir ¶ added in v0.1.333
func UserHomeDir() string
UserHomeDir returns the home directory of the user.
Types ¶
type CountReader ¶ added in v0.1.333
type CountReader struct {
// contains filtered or unexported fields
}
CountReader counts the number of bytes read.
func NewCountReader ¶ added in v0.1.333
func NewCountReader(r io.Reader) *CountReader
NewCountReader function for create new ReaderCounter.
func (*CountReader) Count ¶ added in v0.1.333
func (c *CountReader) Count() int64
Count function returns bytes read so far.
type FileReader ¶
type FileReader struct { Filename string // contains filtered or unexported fields }
FileReader creates a ReadCloser from a filename. If postpones error handling up until the first read. TODO(miku): Throw this out.
type LinkReader ¶
type LinkReader struct { Link string // contains filtered or unexported fields }
LinkReader implements io.Reader for a URL.
type SavedLink ¶
type SavedLink struct { Link string // contains filtered or unexported fields }
SavedLink saves the content of a URL to a file.
type SavedReaders ¶
SavedReaders takes a list of readers and persists their content in a temporary file.
func (*SavedReaders) Remove ¶
func (r *SavedReaders) Remove()
Remove remove any left over temporary file.
func (*SavedReaders) Save ¶
func (r *SavedReaders) Save() (filename string, err error)
Save saves all readers to a temporary file and returns the filename.
type SkipReader ¶
type SkipReader struct { CommentPrefixes []string // contains filtered or unexported fields }
SkipReader skips empty lines and lines with comments.
func NewSkipReader ¶
func NewSkipReader(r *bufio.Reader) *SkipReader
NewSkipReader creates a new SkipReader.
func (SkipReader) ReadString ¶
func (r SkipReader) ReadString(delim byte) (s string, err error)
ReadString will return only non-empty lines and lines not starting with a comment prefix.
type WriteCounter ¶
type WriteCounter struct {
// contains filtered or unexported fields
}
WriteCounter counts the number of bytes written through it.
func (*WriteCounter) Count ¶
func (w *WriteCounter) Count() uint64
Count returns the number of bytes written.
type ZipContentReader ¶
type ZipContentReader struct { Filename string // contains filtered or unexported fields }
ZipContentReader returns the concatenated content of all files in a zip archive given by its filename. All content is temporarily stored in memory, so this type should only be used with smaller archives.
type ZipOrPlainLinkReader ¶
type ZipOrPlainLinkReader struct { Link string // contains filtered or unexported fields }
ZipOrPlainLinkReader is a reader that transparently handles zipped and uncompressed content, given a URL as string.