blache

package
v0.0.0-...-5d70bd9 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Creator

type Creator interface {
	// Create a directory.
	MkdirAll(dir string) error
	// Create a file into the directory dir (can be empty) with the data.
	// This method can be called concurrently an many many time.
	Create(dir, name string, data []byte) error
}

Used to write asset web file and generated file.

type Option

type Option struct {
	// The regions sources.
	In fs.FS
	// The output. Must be defined.
	Out Creator
	// Disable bar print
	NoBar bool
	// The max number of CPU who can be used.
	// If less 0, it will the the number of CPU.
	CPU int
	// Log the error. Is not set, never output.
	Error func(error)
}

All the options for one generation

func (Option) Gen

func (option Option) Gen()

type OsCreator

type OsCreator struct {
	Root       string
	sync.Mutex // used to limit the number of concurent open file.
}

A Creator that write directory and file into the operating system into the root.

func NewOsCreater

func NewOsCreater(root string) OsCreator

Create an OsCreator with the root.

func (*OsCreator) Create

func (c *OsCreator) Create(dir, name string, data []byte) error

Create dir/name with the data.

func (*OsCreator) MkdirAll

func (c *OsCreator) MkdirAll(dir string) error

Create the directory if it doesn't exist.

func (*OsCreator) Set

func (c *OsCreator) Set(root string) error

Set Root. Used for the package package.

func (*OsCreator) String

func (c *OsCreator) String() string

String return the root.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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