Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Example (CopyAndClean) ¶
Output: 20 <nil> test line test line 20 20
Example (CopyAndCleanTmpFile) ¶
Output: 20 <nil> test line test line 20 20 true
Example (CopyAndCleanTmpFileErr) ¶
Output: 0 true true
Example (CopyAndCleanTmpFileToDev) ¶
Output: test line test line 20 <nil> true
Example (CopyAndCleanToDev) ¶
Output: test line test line 20 <nil>
func NewWriter ¶
NewWriter will create a new local writer. - 'pth' is the full path (with filename) that will be written. If the final file extension is a supported compression format then the file will be compressed in that format. - 'append' indicates whether the write session will append the contents to an existing file or truncate and then write. The defaut is false which will truncate an existing file and then write. - 'lazy' set to 'true' will tell the writer to do a lazy write. This means that all write calls will write to memory first and then write to 'pth' when writing is complete with a final call to 'Close'. If Close is never called then the file will not be written.
When initializing a new writer, pth is checked for the correct write permissions. An error is returned if the writer will not have the correct permissions.
For lazy writing, the writer supports writing to memory or a temp file. The writer will use the temp file option if tmpDir and/or tmpPrefix is provided. The writer will remove a temp file with a call to Close.
Example ¶
Output: true <nil>
func (*Writer) Abort ¶
Abort will: - clear and close buffer - prevent further writing
Example ¶
Output: <nil>
func (*Writer) Close ¶
Close will: - calculate final checksum - set file size - set file created date - copy (mv) buffer to pth file - clear and close buffer - report any errors
Calling Abort after Close will do nothing. Writing after Close will not write and will not return a nil-error.
Example ¶
Output: <nil> true 54f30d75cf7374c7e524a4530dbc93c2 true