csv

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

© Ben Garrett https://github.com/bengarrett/dupers

Index

Constants

View Source
const (
	Header = "sha256_sum,path#"
	WinOS  = "windows"

	BackSlash = "\u005C"
	FwdSlash  = "\u002F"
	UncPath   = BackSlash + BackSlash
)

Variables

View Source
var (
	ErrChecksumLen  = errors.New("hexadecimal value is invalid")
	ErrFileNoDesc   = errors.New("no file descriptor")
	ErrImportFile   = errors.New("not a valid dupers export file")
	ErrImportPath   = errors.New("import item has an invalid file path")
	ErrImportSyntax = errors.New("import item has incorrect syntax")
)

Functions

func Bucket

func Bucket(header string) string

Bucket validates the header of a csv file and returns the embedded bucket name.

func Checker

func Checker(file *os.File) error

Checker reads the first line in the export csv file and returns nil if it uses the expected syntax.

func Checksum

func Checksum(s string) ([32]byte, error)

Checksum returns a 64 character hexadecimal string as a bytes representation.

func Import

func Import(line, bucket string) (sum [32]byte, path string, err error)

Import reads, validates and returns a line of data from an export csv file.

func PathPosix

func PathPosix(src string) string

PathPosix returns POSIX path from the source path.

func PathWindows

func PathWindows(src string) string

PathWindows returns a Windows or UNC usable path from the source path.

Types

type Filepath

type Filepath string

Filepath is the absolute path to a file used as a map key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL