func (fx *Pkger) Stat(name string) (os.FileInfo, error) {
	pt, err := fx.Parse(name)
	if err != nil {
		return nil, err
	}
	f, ok := fx.files.Load(pt)
	if ok {
		return f.Stat()
	}
	return nil, fmt.Errorf("could not stat %s", pt)
}
Stat returns a FileInfo describing the named file.
package mem
import (
	"fmt"
	"os"
	"path"
	"path/filepath"
	"strings"
	"time"
	"github.com/markbates/pkger/here"
	"github.com/markbates/pkger/internal/maps"
	"github.com/markbates/pkger/pkging"
)
var _ pkging.Pkger = &Pkger{}
func New(info here.Info) (*Pkger, error) {
	f := &Pkger{
		infos: &maps.Infos{},
		files: &maps.Files{},
		Here:  info,
	}
	f.infos.Store(info.ImportPath, info)
	return f, nil
}
type Pkger struct {
	Here  here.Info
	infos *maps.Infos
	files *maps.Files
}
func (f *Pkger) Current() (here.Info, error) {
	return f.Here, nil
}
func (f *Pkger) Info(p string) (here.Info, error) {
	info, ok := f.infos.Load(p)
	if !ok {
		return info, fmt.Errorf("no such package %q", p)
	}
	return info, nil
}
func (f *Pkger) Parse(p string) (here.Path, error) {
	return f.Here.Parse(p)
}
func (fx *Pkger) Remove(name string) error {
	pt, err := fx.Parse(name)
	if err != nil {
		return err
	}
	if _, ok := fx.files.Load(pt); !ok {
		return &os.PathError{"remove", pt.String(), fmt.Errorf("no such file or directory")}
	}
	fx.files.Delete(pt)
	return nil
}
func (fx *Pkger) RemoveAll(name string) error {
	pt, err := fx.Parse(name)
	if err != nil {
		return err
	}
	fx.files.Range(func(key here.Path, file pkging.File) bool {
		if strings.HasPrefix(key.Name, pt.Name) {
			fx.files.Delete(key)
		}
		return true
	})
	return nil
}
func (fx *Pkger) Create(name string) (pkging.File, error) {
	fx.MkdirAll("/", 0755)
	pt, err := fx.Parse(name)
	if err != nil {
		return nil, err
	}
	her, err := fx.Info(pt.Pkg)
	if err != nil {
		return nil, err
	}
	dir := filepath.Dir(pt.Name)
	if dir != "/" {
		if _, err := fx.Stat(dir); err != nil {
			return nil, err
		}
	}
	f := &File{
		Here: her,
		path: pt,
		info: &pkging.FileInfo{
			Details: pkging.Details{
				Name:    filepath.Base(name),
				Mode:    0644,
				ModTime: pkging.ModTime(time.Now()),
			},
		},
		pkging: fx,
	}
	fx.files.Store(pt, f)
	return f, nil
}
func (fx *Pkger) MkdirAll(p string, perm os.FileMode) error {
	pt, err := fx.Parse(p)
	if err != nil {
		return err
	}
	dir, name := path.Split(pt.Name)
	if dir != "/" {
		if err := fx.MkdirAll(dir, perm); err != nil {
			return err
		}
	}
	if dir == "/" && name == "" {
		dir = filepath.Base(fx.Here.Dir)
	}
	f := &File{
		Here:   fx.Here,
		pkging: fx,
		path:   pt,
		info: &pkging.FileInfo{
			Details: pkging.Details{
				IsDir:   true,
				Name:    name,
				Mode:    perm,
				ModTime: pkging.ModTime(time.Now()),
			},
		},
	}
	if err := f.Close(); err != nil {
		return err
	}
	fx.files.Store(pt, f)
	return nil
}
func (fx *Pkger) Open(name string) (pkging.File, error) {
	pt, err := fx.Parse(name)
	if err != nil {
		return nil, &os.PathError{
			Op:   "open",
			Path: name,
			Err:  err,
		}
	}
	fl, ok := fx.files.Load(pt)
	if !ok {
		return nil, os.ErrNotExist
	}
	f, ok := fl.(*File)
	if !ok {
		return nil, os.ErrNotExist
	}
	nf := &File{
		pkging: fx,
		info:   pkging.NewFileInfo(f.info),
		path:   f.path,
		data:   f.data,
		Here:   f.Here,
	}
	return nf, nil
}