fs

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Overview

Package fs provides a set of filesystem helpers that can be useful when developing Cloud Native Buildpacks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy added in v0.0.14

func Copy(source, destination string) error

Copy will move a source file or directory to a destination. For directories, move will remap relative symlinks ensuring that they align with the destination directory. If the destination exists prior to invocation, it will be removed.

func IsEmptyDir

func IsEmptyDir(path string) bool

IsEmptyDir checks to see if a directory exists and is empty.

func Move

func Move(source, destination string) error

Move will move a source file or directory to a destination. For directories, move will remap relative symlinks ensuring that they align with the destination directory. If the destination exists prior to invocation, it will be removed. Additionally, the source will be removed once it has been copied to the destination.

Types

type ChecksumCalculator

type ChecksumCalculator struct{}

ChecksumCalculator can be used to calculate the SHA256 checksum of a given file or directory. When given a directory, checksum calculation will be performed in parallel.

func NewChecksumCalculator

func NewChecksumCalculator() ChecksumCalculator

NewChecksumCalculator returns a new instance of a ChecksumCalculator.

func (ChecksumCalculator) Sum

func (c ChecksumCalculator) Sum(paths ...string) (string, error)

Sum returns a hex-encoded SHA256 checksum value of a file or directory given a path.

Jump to

Keyboard shortcuts

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