spool

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// spool is immutable, consumed tasks remains in spool.
	IsImmutable = withMutability(immutable)
	// spool is mutable, consumed tasks are removed
	IsMutable = withMutability(mutable)

	// spool fails on error
	WithStrict = withStrict(strict)
	// spool skips error, continue as warning
	WithSkipError = withStrict(skiperror)

	// spool files matching the pattern
	WithPattern = opts.ForName[Spool, string]("pattern")

	// output files with new extension
	WithFileExt = opts.ForName[Spool, string]("ext")
)

Functions

This section is empty.

Types

type File

type File = interface {
	io.Writer
	io.Closer
	Stat() (fs.FileInfo, error)
	Cancel() error
}

File provides I/O access to individual object on the file system.

type FileSystem

type FileSystem interface {
	fs.FS
	Create(path string, attr *struct{}) (File, error)
	Remove(path string) error
}

A FileSystem provides access to a hierarchical file system. The abstraction support I/O to local file system or AWS S3. Use it with https://github.com/fogfish/stream

type Spool

type Spool struct {
	// contains filtered or unexported fields
}

func New

func New(reader, writer FileSystem, opt ...opts.Option[Spool]) *Spool

func (*Spool) ForEach

func (spool *Spool) ForEach(ctx context.Context, dir string, f Writer) error

Apply the spool function over each file in the reader filesystem, producing results to writer file system.

func (*Spool) ForEachPath added in v1.2.7

func (spool *Spool) ForEachPath(ctx context.Context, paths []string, f Writer) error

Apply the spool function over all file in the reader filesystem, producing results to writer file system.

func (*Spool) Partition added in v1.2.5

func (spool *Spool) Partition(
	ctx context.Context,
	dir string,
	f func(context.Context, string, io.Reader) (string, error),
) error

Apply the parition function over each file in the reader filesystem, producing results to writer file system.

func (*Spool) Write

func (spool *Spool) Write(path string, r io.Reader) error

Write new file to spool

func (*Spool) WriteFile

func (spool *Spool) WriteFile(path string, b []byte) error

type Writer added in v1.2.8

type Writer = func(context.Context, string, io.Reader, io.Writer) error

Spool file writer

Jump to

Keyboard shortcuts

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