Skip to content

gofika/fileutil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codecov Build Status go.dev Go Report Card Licenses

fileutil

golang file utils for common use

Basic Usage

Installation

To get the package, execute:

go get github.com/gofika/fileutil

Example

package main

import (
	"fmt"
	"github.com/gofika/fileutil"
)

func main() {
	name := "foo/bar.txt"
	data := []byte("Hello")
	// write data to file. will create dir: foo
	err := fileutil.WriteFile(name, data)
	if err != nil {
		fmt.Printf("Write file failed. err: %s\n", err.Error())
		return
	}
	// check file exist
	if !fileutil.IsExist(name) {
		fmt.Printf("file %s not exist.\n", name)
		return
	}
	// clear temp file
	fileutil.DeleteAll("foo")
}

About

golang file utils for common use

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages