func (fs *VirtualFileSystem) Exists(path string) bool {
	fs.mutex.RLock()
	defer fs.mutex.RUnlock()
	_, ok := fs.files[path]
	return ok
}
Exists takes a path and checks to see if the potential file exists or
not.
Note: If there is an error trying to read that file, it will return false
even if the file already exists.
package fsys
import (
	"bytes"
	"io"
	"os"
	"path/filepath"
	"strings"
	"sync"
	"time"
	"github.com/pkg/errors"
)
type VirtualFileSystem struct {
	mutex sync.RWMutex
	files map[string]*virtualFile
}
func NewVirtualFileSystem() *VirtualFileSystem {
	return &VirtualFileSystem{
		files: map[string]*virtualFile{},
	}
}
func (fs *VirtualFileSystem) Create(path string) (File, error) {
	fs.mutex.Lock()
	defer fs.mutex.Unlock()
	f := &virtualFile{
		name:  path,
		atime: time.Now(),
		mtime: time.Now(),
	}
	fs.files[path] = f
	return f, nil
}
func (fs *VirtualFileSystem) Open(path string) (File, error) {
	fs.mutex.RLock()
	defer fs.mutex.RUnlock()
	f, ok := fs.files[path]
	if !ok {
		return nil, errNotFound{os.ErrNotExist}
	}
	return &virtualFile{
		name:  f.name,
		atime: f.atime,
		mtime: f.mtime,
		buf:   *bytes.NewBuffer(f.buf.Bytes()),
	}, nil
}
func (fs *VirtualFileSystem) OpenFile(path string, flag int, perm os.FileMode) (File, error) {
	return fs.Open(path)
}
func (fs *VirtualFileSystem) Rename(oldname, newname string) error {
	fs.mutex.Lock()
	defer fs.mutex.Unlock()
	f, ok := fs.files[oldname]
	if !ok {
		return errNotFound{os.ErrNotExist}
	}
	delete(fs.files, oldname)
	fs.files[newname] = f
	return nil
}