Skip to content

A map-based vfs.FileSystem implementation that stores both the contents and the modification times for files.

License

Notifications You must be signed in to change notification settings

ZoltanLajosKis/go-mapfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-mapfs

Build Status Go Report Card Coverage Status GoDoc

A map-based vfs.FileSystem implementation that stores both the contents and the modification times for files.

Usage

Each input file is represented by the File structure that stores the contents and the modification time of the file.

type File struct {
  Data    []byte
  ModTime time.Time
}

These Files are collected in a Files map that maps each file to the file's path.

type Files map[string]*File

The New function creates the file system from the map.

func New(Files) (vfs.FileSystem, error)

Example

package main

import (
  "time"

  "github.com/ZoltanLajosKis/go-mapfs"
)

func main() {
  files := mapfs.Files{
    "test/hello.txt": {
      []byte("Hello."),
      time.Date(2017, 1, 1, 0, 0, 0, 0, time.UTC),
    },
    // additional files ...
  }

  fs, err := mapfs.New(files)
}

About

A map-based vfs.FileSystem implementation that stores both the contents and the modification times for files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages