fileops

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDir

func CreateDir(dirPath string) error

CreateDir creates a dir for dirPath. If the dirPath already exists, it returns nil, i.e., no-op

func CreateFile

func CreateFile(filePath string) error

CreateFile creates a file. It retuns an error if the file already exists

func Exists

func Exists(filePath string) (bool, error)

Exists checks whether the given file exists.

func IsDirEmpty

func IsDirEmpty(dirPath string) (bool, error)

IsDirEmpty returns true if the dir at dirPath is empty

func ListSubdirs

func ListSubdirs(dirPath string) ([]string, error)

ListSubdirs returns the subdirectories

func OpenFile

func OpenFile(filePath string, perm os.FileMode) (*os.File, error)

OpenFile opens an existing file. If the file does not exist, it creates a new one.

func Remove

func Remove(path string) error

Remove removes the file

func RemoveAll

func RemoveAll(path string) error

RemoveAll removes all files/directories present in the path including the path itself

func SyncDir

func SyncDir(dirPath string) error

SyncDir fsyncs the given dir

func Truncate

func Truncate(f *os.File, toSize int64) error

Truncate truncates the file to a given size and also reset the IO offset

func Write

func Write(f *os.File, content []byte) (int, error)

Write writes the given content to the file

Types

This section is empty.

Jump to

Keyboard shortcuts

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