textbundle

package module
v0.0.0-...-d11aede Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: MIT Imports: 6 Imported by: 2

README

EXPERIMENTAL TextBundle library for Go

GoDoc

This is a little Go library for working with TextBundle resources.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	Name string
	File *zip.File
}

Asset is a light wrapper around zip.File that trims the filename.

type Metadata

type Metadata struct {
	Version           int    `json:"version"`
	Type              string `json:"type,omitempty"`
	Transient         bool   `json:"transient,omitempty"`
	CreatorURL        string `json:"creatorURL,omitempty"`
	CreatorIdentifier string `json:"creatorIdentifier,omitempty"`
	SourceURL         string `json:"sourceURL,omitempty"`
}

type Reader

type Reader struct {
	Metadata Metadata
	Text     []byte
	Assets   []Asset
}

Reader allows access the seperate Assets of a TextBundle, its content, and the associated metadata.

func OpenReader

func OpenReader(path string) (*Reader, error)

OpenReader creates a new Reader from the given file path.

type Writer

type Writer struct {
	Metadata Metadata
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(out io.Writer) *Writer

NewWriter creates a new writer which should be persisted to the out.

func (*Writer) Close

func (w *Writer) Close() error

Close finalizes the bundles metadata and closes the underlying writer.

func (*Writer) CreateAsset

func (w *Writer) CreateAsset(name string) (io.Writer, error)

CreateAsset creates a new asset file with the given name.

func (*Writer) Flush

func (w *Writer) Flush() error

Flush flushes the underlying writer.

func (*Writer) SetText

func (w *Writer) SetText(typ string, content string) error

SetText writes Content.textbundle/text.$typ.

Jump to

Keyboard shortcuts

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