txtarfs

package module
v0.0.0-...-5dc76b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 3 Imported by: 3

README

Package txtarfs turns a txtar into an fs.FS. And vice-versa.

It is a stopgap until txtar implements fs.FS directly.

MIT license.

Documentation

Overview

Package txtarfs turns a txtar into an fs.FS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(ar *txtar.Archive) fs.FS

As returns an io/fs.FS containing ar's contents. Subsequent changes to ar may or may not be reflected in the returned fs.FS.

func From

func From(fsys fs.FS) (*txtar.Archive, error)

From constructs a txtar.Archive with the contents of fsys and an empty Comment. Subsequent changes to fsys are not reflected in the returned archive.

The transformation is lossy. For example, because directories are implicit in txtar archives, empty directories in fsys will be lost. And txtar does not represent file mode, mtime, or other file metadata.

Note also this warning from function txtar.Format:

It is assumed that the Archive data structure is well-formed:
a.Comment and all a.File[i].Data contain no file marker lines,
and all a.File[i].Name is non-empty.

From does not guarantee that a.File[i].Data contain no file marker lines.

In short, it is unwise to use From/As as a generic filesystem serialization mechanism.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL