fileutils

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2019 License: MIT Imports: 6 Imported by: 53

README

fileutils

Build Coverage Go Report Card Documentation

The fileutils package offers some useful utils to work with the filesystem such copy file, copy directory and a filesystem interface restricted to a specific path.

License

MIT © Henrique Dias

Documentation

Overview

Package fileutils implements some useful functions to work with the file system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(source string, dest string) error

CopyDir copies a directory from source to dest and all of its sub-directories. It doesn't stop if it finds an error during the copy. Returns an error if any.

func CopyFile

func CopyFile(source string, dest string) error

CopyFile copies a file from source to dest and returns an error if any.

func SlashClean

func SlashClean(name string) string

SlashClean is equivalent to but slightly more efficient than path.Clean("/" + name).

Types

type Dir

type Dir string

A Dir uses the native file system restricted to a specific directory tree. Originally from ttps://github.com/golang/net/blob/master/webdav/file.go An empty Dir is treated as ".".

func (Dir) Copy

func (d Dir) Copy(src, dst string) error

Copy copies a file or directory from src to dst. If it is a directory, all of the files and sub-directories will be copied.

func (Dir) Mkdir

func (d Dir) Mkdir(name string, perm os.FileMode) error

Mkdir implements os.Mkdir in this directory context.

func (Dir) OpenFile

func (d Dir) OpenFile(name string, flag int, perm os.FileMode) (*os.File, error)

OpenFile implements os.OpenFile in this directory context.

func (Dir) RemoveAll

func (d Dir) RemoveAll(name string) error

RemoveAll implements os.RemoveAll in this directory context.

func (Dir) Rename

func (d Dir) Rename(oldName, newName string) error

Rename implements os.Rename in this directory context.

func (Dir) Stat

func (d Dir) Stat(name string) (os.FileInfo, error)

Stat implements os.Stat in this directory context.

func (Dir) String

func (d Dir) String() string

Jump to

Keyboard shortcuts

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