Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/prongbang/filex

File management for Golang
https://github.com/prongbang/filex

create-file create-image create-image-from-text filex golang

Last synced: 23 days ago
JSON representation

File management for Golang

Awesome Lists containing this project

README

        

# FileX

File management for Golang

[![Build Status](http://img.shields.io/travis/prongbang/filex.svg)](https://travis-ci.org/prongbang/filex)
[![Go Report Card](https://goreportcard.com/badge/github.com/prongbang/filex)](https://goreportcard.com/report/github.com/prongbang/filex)

```
go get github.com/prongbang/filex
```

### How to use

- New FileX

```go
fileX := filex.New()
```

- Make Directory

```go
isSuccess := fileX.Mkdir("public/thumbnail")
```

- Create Image from Bytes Array

```go
imgPath := "public/thumbnail/image.jpeg"

imgByte := []byte("mock image byte array")
fileX.CreateImage(imgByte, imgPath)
```

- Create File from Multipart

```go
path := "public/thumbnail"
filename := "image.jpeg"
var file *multipart.FileHeader = mockFile
pathFile, err := fileX.CreateMultipart(path, filename, file)
```

- Delete file

```go
path, err := fileX.Delete(imgPath)
```

- Delete directory

```go
err := fileX.DeleteDir("dir")
```