file

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package file provides file related implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDirectory

func CreateDirectory(name string, fileMode os.FileMode) error

CreateDirectory creates a directory.

ex 1) err := file.CreateDirectory(name, 0777) ex 2) err := file.CreateDirectory(name, os.ModePerm)

func CreateDirectoryAll

func CreateDirectoryAll(path string, fileMode os.FileMode) error

CreateDirectoryAll creates a directory (including subdirectories).

ex 1) err := file.CreateDirectoryAll(path, 0777) ex 2) err := file.CreateDirectoryAll(path, os.ModePerm)

func List

func List(path string, recursive bool) ([]string, error)

List is get file list.

ex) list, err := file.List(dir, true)

func Read

func Read(fileName string) (string, error)

Read is get the data of a file.

ex) data, err := file.Read(fileName)

func Remove

func Remove(name string) error

Remove removes a file or empty directory.

ex) err := file.Remove(name)

func RemoveAll

func RemoveAll(path string) error

RemoveAll removes a path(including subpaths).

ex) err := file.RemoveAll(path)

func Write

func Write(fileName string, data string, fileMode os.FileMode) error

Write is write data to file.

ex 1) err := file.Write(fileName, data, 0600) ex 2) err := file.Write(fileName, data, os.ModePerm)

Types

This section is empty.

Jump to

Keyboard shortcuts

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