chentex / go-fm

A simple file manager library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-fm

A simple file manager library.

Build Status codecov GoDoc Go Report Card BCH compliance

Package errors provides simple error handling primitives and behavioral errors.

go get github.com/chentex/go-fm

Read the package documentation for more information.

Motivation

Every time you need to manage some files you tend to use the same code over and over, and you always have to test no matter how many times you have written the code.

This library is a wrapper for reading, writing and checking if files exists. It's already tested so you can use it without worrying to write the test for this module, and just focus on writing your code.

Usage

Import

import "github.com/chentex/go-fm" fm

New File Manager

fileManager := fm.NewFileManager()

Reading a file

content, err := fm.OpenFile("yourfile.txt")
if err != nil {
    fmt.Printf(err)
}

Writing a file

bytes := byte[]("sample text to insert in file")
err := fm.WriteFile("yourfile.txt", bytes, 0644)
if err != nil {
    fmt.Printf(err)
}

Checking for a file

exists, err := fm.ExistsFile("yourfile.txt")
if err != nil {
    fmt.Printf(err)
}

fmt.Printf(exists)

Contributing

I welcome pull requests, bug fixes and issue reports.

Maintainer: Vicente Zepeda (chente.z.m@gmail.com)

About

A simple file manager library

License:MIT License


Languages

Language:Go 87.8%Language:Makefile 7.5%Language:Shell 4.8%