Features
In-Memory
Files exist only in RAM until explicitly serialised
fs.FS Compatible
Works with any Go code expecting a filesystem
Flat Key-Value
Paths are keys, directories are implicit from prefixes
Multi-Source
Collect from GitHub repos, websites, PWAs, local disk
Installation
import "github.com/Snider/Borg/pkg/datanode"
dn := datanode.New()
dn.WriteFile("config.json", []byte("{...}"))
dn.WriteFile("src/main.go", []byte("package main..."))
// Implements fs.FS
data, _ := fs.ReadFile(dn, "config.json")
Usage
Core Type
type DataNode struct {
files map[string]*dataFile
}
type dataFile struct {
name string
content []byte
modTime time.Time
}
Serialisation
// To tar
tarBytes := dn.ToTar()
// To encrypted TRIX
trixBytes := dn.ToTrix(password)
// From tar
dn, _ := datanode.FromTar(tarBytes)
Quick Links
More from Lethean R&D Labs
Fancy helping out?
Spotted a bug? Got an idea? We'd love to hear from you.
Read the contributing guide →