filex

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

* @Author: cnzf1 * @Date: 2021-07-19 11:58:51 * @LastEditors: cnzf1 * @LastEditTime: 2023-01-11 11:09:34 * @Description:

Index

Constants

View Source
const (
	NL = "\n"
)

NL defines a new line

Variables

This section is empty.

Functions

func CreateIfNotExist

func CreateIfNotExist(file string) (*os.File, error)

CreateIfNotExist creates a file if it is not exists

func FileExists

func FileExists(file string) bool

FileExists returns true if the specified file is exists

func FileNameWithoutExt

func FileNameWithoutExt(file string) string

FileNameWithoutExt returns a file name without suffix

func MkdirIfNotExist

func MkdirIfNotExist(dir string) error

MkdirIfNotExist makes directories if the input path is not exists

func ReadLinesOffsetN

func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error)

ReadLines reads contents from a file and splits them by new lines. A convenience wrapper to ReadLinesOffsetN(filename, 0, -1).

func RemoveIfExist

func RemoveIfExist(filename string) error

RemoveIfExist deletes the specified file if it is exists

func RemoveOrQuit

func RemoveOrQuit(filename string) error

RemoveOrQuit deletes the specified file if read a permit command from stdin

Types

This section is empty.

Jump to

Keyboard shortcuts

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