files

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package files

  • Version: 1.0.0
  • Copyright (c) 2021. Pashifika *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

Package files

  • Version: 1.0.0
  • Copyright (c) 2021. Pashifika *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BufferToFile

func BufferToFile(path string, r io.Reader) (err error)

BufferToFile write buffer to file. (best to the big file)

func ByteToFile

func ByteToFile(path string, buf []byte) (err error)

ByteToFile write bytes to file. (best to the small file)

func Exists

func Exists(path string) bool

Exists returns whether the given file or directory exists or not

func FileOpen

func FileOpen(path, mode string) (*os.File, error)

FileOpen os full path.

w open the file write-only. (support create a new file)

r open the file read-only.

a append data to the file when writing. (aw is support create a new file)

rw open the file read-write. (support create a new file)

func GetFileList

func GetFileList(path, filter string, fullPath bool) ([]string, error)

GetFileList used regexp filtering files

func MkdirIfNotExist

func MkdirIfNotExist(path string) error

MkdirIfNotExist used os.MkdirAll to make path's all dir

func PathBaseAddPrefix

func PathBaseAddPrefix(path, prefix string) string

PathBaseAddPrefix add prefix to the last element of path.

func PathBaseAddSuffix

func PathBaseAddSuffix(path, suffix string) string

PathBaseAddSuffix add suffix to the last element of path.

func RemoveNameExt

func RemoveNameExt(name string) string

RemoveNameExt remove file name's extension used of path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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