Documentation ¶
Overview ¶
Package yamlfs provides a virtual filesystem based on the structure and content of a yaml document.
Hereby maps are used to represent the directory hierarchy. Content of a field will be offered as file content. To represent more complex cases a map inclusing the field `$type` is not interpreted as directory by default, but according to the value of the type attribute.
- type `directory`: the field `value` is used a directory content
- type `file`: the field `value` is used as file content
- type `symlink`: the field `value` is used symlink content
- type `yaml`: the field `value` is used to provide file content that is provided as yaml file data (read and write)
- type `json`: the field `value` is used to provide file content that is provided as json file data (read and write)
string data starting with a line `---Start Binary---`and finished with a line ` ---End Binary---` interpretes the data in-between as bas64 encoded binary data. The latest version is able to handle binary data directly as described by the yaml format for reading and writing.
Index ¶
Constants ¶
View Source
const BinaryEndMarker = "---End Binary---"
View Source
const BinaryStartMarker = "---Start Binary---"
Variables ¶
View Source
var UseStandardYAMLBinary = true
Functions ¶
func FromBinary ¶
func FromBinary(data []byte) interface{}
Types ¶
type DataMarshaller ¶
type DataMarshaller func(data []byte) interface{}
type YamlFileSystem ¶
type YamlFileSystem struct { vfs.FileSystem // contains filtered or unexported fields }
func New ¶
func New(data []byte) (*YamlFileSystem, error)
func NewByData ¶
func NewByData(data map[interface{}]interface{}) *YamlFileSystem
func NewByPath ¶
func NewByPath(fs vfs.FileSystem, path string) (*YamlFileSystem, error)
func (*YamlFileSystem) Data ¶
func (y *YamlFileSystem) Data() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.