Documentation ¶
Overview ¶
Package checksum gets the checksum of a file or files withing a directory.
You will need to import the appropriate package in you package to be able to get the checksum of the files. Check out https://golang.org/pkg/crypto/#Hash to get a list of possable checksums and which imports to include in your package. You will need to do something like:
import _ "crypto/md5"
to import the appropriate hash into your package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //ErrCannotBeRead is returned when file or folder could not be read for meta information. ErrCannotBeRead = errors.New("This file/folder could not be read") //ErrFileReading is returned when while reading the file an error occured. ErrFileReading = errors.New("This file had an error while reading") //ErrFileNotOpen is returned when this package could not open the file for reading. ErrFileNotOpen = errors.New("This file could not be opened") //ErrFileIsDirectory is returned when using the wrong method when passing in a directory. ErrFileIsDirectory = errors.New("File is a directory and should use the Directory function") //ErrHashBinary is returned when the proper binary is not included in the executable for the given has. ErrHashBinary = errors.New("Supplied hash's binary is not included in executable") //ErrImproperLength is returned when the expected number of bytes is not written to the hashing function. ErrImproperLength = errors.New("Did not write expected number of bytes to the hashing function") //ErrWritingHash is returned when there was a problem writing bytes to the hashing function. ErrWritingHash = errors.New("Could not write bytes to the hashubg function") //ErrWalking is returned when there was an issue walking to the specified file or folder. ErrWalking = errors.New("There was a problem walking to this file/folder") //ErrNotRegular is returned when the file is not a regular file. ErrNotRegular = errors.New("The file is not a regular file") )
View Source
var ( //BufferSize is used to buffer the file before hashing. BufferSize = 4096 //Limit is the limit of how many open files to process at one time. Limit = 100 )
Functions ¶
Types ¶
type FileChecksum ¶
FileChecksum is the checksum of a file.
type FileChecksumResponse ¶
type FileChecksumResponse struct { Checksum *FileChecksum Err error }
FileChecksumResponse is a response from this library over the channel.
func NewResponse ¶
func NewResponse(checksum *FileChecksum, err error) FileChecksumResponse
NewResponse creates a new response for the channel.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
checksum
checksum creates a cli function for creating checksums of files Install To install my application run: go get github.com/dixonwille/checksum/cmd/checksum or go to the release on github and grab the appropriate binary.
|
checksum creates a cli function for creating checksums of files Install To install my application run: go get github.com/dixonwille/checksum/cmd/checksum or go to the release on github and grab the appropriate binary. |
Click to show internal directories.
Click to hide internal directories.