file

package
v0.0.0-...-2d88c84 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package file contains some simple utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// contains filtered or unexported fields
}

File manages file system crud.

func New

func New(
	appFs afero.Fs,
) *File

New create a file instance.

func (*File) Exists

func (f *File) Exists(
	filePath string,
) bool

Exists reports if the named file or directory exists.

func (*File) GetMode

func (f *File) GetMode(
	filePath string,
) (fs.FileMode, error)

GetMode returns the named files mode.

func (*File) Read

func (f *File) Read(
	filePath string,
) ([]byte, error)

Read reads the contents of the filePath.

func (*File) Remove

func (f *File) Remove(
	filePath string,
) error

Remove removes the named file if exists.

func (*File) SetMode

func (f *File) SetMode(
	filePath string,
	mode fs.FileMode,
) error

SetMode sets the named files mode.

Jump to

Keyboard shortcuts

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