fs

package
v2.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 65

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

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 Exists

func Exists(path string) (bool, error)

Exists returns true if a file or directory at the given path is present and false otherwise.

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