func (driver *FileDriver) Delete(id string) error {
	id = base64.StdEncoding.EncodeToString([]byte(id))
	return os.Remove(filepath.Join(driver.filePath, id+".json"))
}
Delete deletes a paste
package file
import (
	"encoding/base64"
	"encoding/json"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"time"
	"github.com/lus/pasty/internal/config"
	"github.com/lus/pasty/internal/shared"
)
type FileDriver struct {
	filePath string
}
func (driver *FileDriver) Initialize() error {
	driver.filePath = config.Current.File.Path
	return os.MkdirAll(driver.filePath, os.ModePerm)
}
func (driver *FileDriver) Terminate() error {
	return nil
}
func (driver *FileDriver) ListIDs() ([]string, error) {
	var ids []string
	err := filepath.Walk(driver.filePath, func(path string, info os.FileInfo, err error) error {
		if err != nil {
			return err
		}
		if !strings.HasSuffix(info.Name(), ".json") {
			return nil
		}
		decoded, err := base64.StdEncoding.DecodeString(strings.TrimSuffix(info.Name(), ".json"))
		if err != nil {
			return err
		}
		ids = append(ids, string(decoded))
		return nil
	})
	if err != nil {
		return nil, err
	}
	return ids, nil
}
func (driver *FileDriver) Get(id string) (*shared.Paste, error) {
	id = base64.StdEncoding.EncodeToString([]byte(id))
	data, err := ioutil.ReadFile(filepath.Join(driver.filePath, id+".json"))
	if err != nil {
		if os.IsNotExist(err) {
			return nil, nil
		}
		return nil, err
	}
	paste := new(shared.Paste)
	err = json.Unmarshal(data, &paste)
	if err != nil {
		return nil, err
	}
	return paste, nil
}
func (driver *FileDriver) Save(paste *shared.Paste) error {
	jsonBytes, err := json.Marshal(paste)
	if err != nil {
		return err
	}
	id := base64.StdEncoding.EncodeToString([]byte(paste.ID))
	file, err := os.Create(filepath.Join(driver.filePath, id+".json"))
	if err != nil {
		return err
	}
	defer file.Close()
	_, err = file.Write(jsonBytes)
	return err
}