fsync

package module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: MIT Imports: 7 Imported by: 64

README

Package fsync keeps files and directories in sync. Read the documentation on GoDoc.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFileOverDir = errors.New(
		"fsync: trying to overwrite a non-empty directory with a file")
)

Functions

func Sync

func Sync(dst, src string) error

Sync copies files and directories inside src into dst.

func SyncTo

func SyncTo(to string, srcs ...string) error

SyncTo syncs srcs files and directories into to directory.

Types

type Syncer

type Syncer struct {
	// Set this to true to delete files in the destination that don't exist
	// in the source.
	Delete bool
	// To allow certain files to remain in the destination, implement this function.
	// Return true to skip file, false to delete.
	DeleteFilter func(f os.FileInfo) bool
	// By default, modification times are synced. This can be turned off by
	// setting this to true.
	NoTimes bool
	// NoChmod disables permission mode syncing.
	NoChmod bool
	// Implement this function to skip Chmod syncing for only certain files
	// or directories. Return true to skip Chmod.
	ChmodFilter func(dst, src os.FileInfo) bool

	SrcFs  afero.Fs
	DestFs afero.Fs
}

Type Syncer provides functions for syncing files.

func NewSyncer

func NewSyncer() *Syncer

NewSyncer creates a new instance of Syncer with default options.

func (*Syncer) Sync

func (s *Syncer) Sync(dst, src string) error

Sync copies files and directories inside src into dst.

func (*Syncer) SyncTo

func (s *Syncer) SyncTo(to string, srcs ...string) error

SyncTo syncs srcs files or directories into to directory.

Jump to

Keyboard shortcuts

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