filex

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 9 Imported by: 0

README

FileX

File management for Golang

Build Status Go Report Card

go get github.com/prongbang/filex
How to use
  • New FileX
fileX := filex.New()
  • Make Directory
isSuccess := fileX.Mkdir("public/thumbnail")
  • Create Image from Bytes Array
imgPath := "public/thumbnail/image.jpeg"

imgByte := []byte("mock image byte array")
fileX.CreateImage(imgByte, imgPath)
  • Create File from Multipart
path := "public/thumbnail"
filename := "image.jpeg"
var file *multipart.FileHeader = mockFile
pathFile, err := fileX.CreateMultipart(path, filename, file)
  • Delete file
path, err := fileX.Delete(imgPath)
  • Delete directory
err := fileX.DeleteDir("dir")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileX

type FileX interface {
	CreateMultipart(path string, filename string, file *multipart.FileHeader) (string, error)
	CreateImage(imgByte []byte, path string) (string, error)
	CreateFile(path string, fileName string, data string) (string, error)
	Delete(path string) (string, error)
	DeleteDir(path string) error
	Mkdir(dirName string) bool
	Read(path string) []byte
}

FileX is a interface

func New

func New() FileX

New a instance

Jump to

Keyboard shortcuts

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