cwimkit

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

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

Go to latest
Published: May 30, 2023 License: MIT-0 Imports: 18 Imported by: 0

README

cwimkit

This project provides Go native bindings to wimlib compiled to a WebAssembly module using wazero, no cgo required.

Documentation

Index

Constants

View Source
const (
	IterateDirTreeRecursive       = 0x00000001
	IterateDirTreeChildren        = 0x00000002
	IterateDirTreeResourcesNeeded = 0x00000004
)
View Source
const (
	ExportBoot = 1 << iota
	ExportNoNames
	ExportNoDescriptions
	ExportGift
)
View Source
const (
	AddNtfs int32 = 1 << iota
	AddDereference
	AddVerbose
	AddBoot
	AddUnixData
	AddNoAcls
	AddStrictAcls
	AddExcludeVerbose
	AddRPFix
	AddNoRPFix
	AddNoUnsupportedExclude
	AddWinConfig
	AddWimBoot
	AddNoReplace
	AddTestFileExclusion
	AddSnapshot
	AddFilePathsUnneeded
)
View Source
const (
	DeleteFlagForce int32 = 1 << iota
	DeleteFlagRecursive
)
View Source
const (
	OpenCheckIntegrity int32 = 1 << iota
	OpenErrorIfSplit
	OpenWriteAccess
)
View Source
const (
	WriteCheckIntegrity int32 = 1 << iota
	WriteNoCheckIntegrity
	WritePipable
	WriteNotPipable
	WriteRecompress
	WriteFsync
	WriteRebuild
	WriteSoftDelete
	WriteIgnoreReadonlyFlag
	WriteSkipExternalWims
	WriteStreamsOk
	WriteRetainGuid
	WriteSolid
	WriteSendDoneWithFileMessages
	WriteNoSolidSort
	WriteUnsafeCompact
)
View Source
const AllImages = -1
View Source
const PointerSize = 4 // TODO: Oof.
View Source
const WimlibGuidLen = 16

Variables

View Source
var (
	ErrNoMemory   = ModuleError("out of memory")
	ErrOOBRead    = ModuleError("out of bounds read")
	ErrOOBWrite   = ModuleError("out of bounds write")
	ErrNoFunction = ModuleError("missing function")
)
View Source
var (
	ErrAlreadyLocked                  = WimlibError(1)
	ErrDecompression                  = WimlibError(2)
	ErrFuse                           = WimlibError(6)
	ErrGlobHadNoMatches               = WimlibError(8)
	ErrImageCount                     = WimlibError(10)
	ErrImageNameCollision             = WimlibError(11)
	ErrInsufficientPrivileges         = WimlibError(12)
	ErrIntegrity                      = WimlibError(13)
	ErrInvalidCaptureConfig           = WimlibError(14)
	ErrInvalidChunkSize               = WimlibError(15)
	ErrInvalidCompressionType         = WimlibError(16)
	ErrInvalidHeader                  = WimlibError(17)
	ErrInvalidImage                   = WimlibError(18)
	ErrInvalidIntegrityTable          = WimlibError(19)
	ErrInvalidLookupTableEntry        = WimlibError(20)
	ErrInvalidMetadataResource        = WimlibError(21)
	ErrInvalidOverlay                 = WimlibError(23)
	ErrInvalidParam                   = WimlibError(24)
	ErrInvalidPartNumber              = WimlibError(25)
	ErrInvalidPipableWim              = WimlibError(26)
	ErrInvalidReparseData             = WimlibError(27)
	ErrInvalidResourceHash            = WimlibError(28)
	ErrInvalidUtf16String             = WimlibError(30)
	ErrInvalidUtf8String              = WimlibError(31)
	ErrIsDirectory                    = WimlibError(32)
	ErrIsSplitWim                     = WimlibError(33)
	ErrLink                           = WimlibError(35)
	ErrMetadataNotFound               = WimlibError(36)
	ErrMkdir                          = WimlibError(37)
	ErrMqueue                         = WimlibError(38)
	ErrNoMem                          = WimlibError(39)
	ErrNotDir                         = WimlibError(40)
	ErrNotEmpty                       = WimlibError(41)
	ErrNotARegularFile                = WimlibError(42)
	ErrNotAWimFile                    = WimlibError(43)
	ErrNotPipable                     = WimlibError(44)
	ErrNoFilename                     = WimlibError(45)
	ErrNtfs3G                         = WimlibError(46)
	ErrOpen                           = WimlibError(47)
	ErrOpenDir                        = WimlibError(48)
	ErrPathDoesNotExist               = WimlibError(49)
	ErrRead                           = WimlibError(50)
	ErrReadLink                       = WimlibError(51)
	ErrRename                         = WimlibError(52)
	ErrReparsePointFixupFailed        = WimlibError(54)
	ErrResourceNotFound               = WimlibError(55)
	ErrResourceOrder                  = WimlibError(56)
	ErrSetAttributes                  = WimlibError(57)
	ErrSetReparseData                 = WimlibError(58)
	ErrSetSecurity                    = WimlibError(59)
	ErrSetShortName                   = WimlibError(60)
	ErrSetTimestamps                  = WimlibError(61)
	ErrSplitInvalid                   = WimlibError(62)
	ErrStat                           = WimlibError(63)
	ErrUnexpectedEndOfFile            = WimlibError(65)
	ErrUnicodeStringNotRepresentable  = WimlibError(66)
	ErrUnknownVersion                 = WimlibError(67)
	ErrUnsupported                    = WimlibError(68)
	ErrUnsupportedFile                = WimlibError(69)
	ErrWimIsReadonly                  = WimlibError(71)
	ErrWrite                          = WimlibError(72)
	ErrXml                            = WimlibError(73)
	ErrWimIsEncrypted                 = WimlibError(74)
	ErrWIMBoot                        = WimlibError(75)
	ErrAbortedByProgress              = WimlibError(76)
	ErrUnknownProgressStatus          = WimlibError(77)
	ErrMknod                          = WimlibError(78)
	ErrMountedImageIsBusy             = WimlibError(79)
	ErrNotAMountPoint                 = WimlibError(80)
	ErrNotPermittedToUnmount          = WimlibError(81)
	ErrFveLockedVolume                = WimlibError(82)
	ErrUnableToReadCaptureConfig      = WimlibError(83)
	ErrWimIsIncomplete                = WimlibError(84)
	ErrCompactionNotPossible          = WimlibError(85)
	ErrImageHasMultipleReferences     = WimlibError(86)
	ErrDuplicateExportedImage         = WimlibError(87)
	ErrConcurrentModificationDetected = WimlibError(88)
	ErrSnapshotFailure                = WimlibError(89)
	ErrInvalidXAttr                   = WimlibError(90)
	ErrSetXAttr                       = WimlibError(91)
)

Functions

func SetAssembly

func SetAssembly(data []byte)

SetAssembly sets the wimlib WebAssembly binary to use.

Types

type API

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

func (*API) AddEmptyImage

func (api *API) AddEmptyImage(ctx context.Context, wim Pointer, name string) (int, error)

func (*API) CreateDecompressor

func (api *API) CreateDecompressor(ctx context.Context, ctype, chunkLen int32) (Pointer, error)

func (*API) CreateNewWIM

func (api *API) CreateNewWIM(ctx context.Context, ctype CompressionType) (Pointer, error)

func (*API) Decompress

func (api *API) Decompress(ctx context.Context, dec Pointer, inp, out []byte) error

func (*API) DeleteImage

func (api *API) DeleteImage(ctx context.Context, wim Pointer, iid int32) error

func (*API) ExportImage

func (api *API) ExportImage(
	ctx context.Context, swim Pointer, siid int, dwim Pointer, name, desc *string, flags int,
) (err error)

func (*API) FreeDecompressor

func (api *API) FreeDecompressor(ctx context.Context, dec Pointer) (err error)

func (*API) FreeWIM

func (api *API) FreeWIM(ctx context.Context, wim Pointer) error

func (*API) IterateDirTree

func (api *API) IterateDirTree(
	ctx context.Context,
	wim Pointer,
	iid int32,
	path string,
	flags int32,
	cb IterateDirTreeCb,
) error

func (*API) OpenWIM

func (api *API) OpenWIM(ctx context.Context, path string, flags int32) (Pointer, error)

func (*API) OverwriteWIM

func (api *API) OverwriteWIM(ctx context.Context, wim Pointer, flags int32, threads uint32) error

func (*API) PrintErrors

func (api *API) PrintErrors(ctx context.Context) error

func (*API) PrintHeader

func (api *API) PrintHeader(ctx context.Context, wim Pointer) error

func (*API) ResolveImage

func (api *API) ResolveImage(ctx context.Context, wim Pointer, nameOrIID string) (int32, error)

func (*API) SetImageProperty

func (api *API) SetImageProperty(ctx context.Context, wim Pointer, iid int, name string, value *string) error

func (*API) UpdateImage

func (api *API) UpdateImage(
	ctx context.Context,
	wim Pointer,
	iid int32,
	flags int32,
	cmds ...WriterToProvider,
) error

func (*API) WriteWIM

func (api *API) WriteWIM(ctx context.Context, wim Pointer, path string, iid int32, flags int32, threads uint32) error

type CompressionType

type CompressionType int32
const (
	CompressionTypeXPRESS CompressionType = iota + 1
	CompressionTypeLZX
	CompressionTypeLZMS
)

type DirEntry

type DirEntry struct {
	Packed dirEntryPacked
	// contains filtered or unexported fields
}

func (*DirEntry) Filename

func (e *DirEntry) Filename() (string, error)

func (*DirEntry) FullPath

func (e *DirEntry) FullPath() (string, error)

func (*DirEntry) ShortName

func (e *DirEntry) ShortName() (string, error)

func (*DirEntry) Stream

func (e *DirEntry) Stream(i int) (*StreamEntry, error)

func (*DirEntry) StreamsNum

func (e *DirEntry) StreamsNum() int

type Instance

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

func NewInstance

func NewInstance(ctx context.Context) (*Instance, error)

func (*Instance) API

func (inst *Instance) API() *API

func (*Instance) Close

func (inst *Instance) Close(ctx context.Context) error

type IterateDirTreeCb

type IterateDirTreeCb func(entry *DirEntry) error

type ModuleError

type ModuleError string

func (ModuleError) Error

func (e ModuleError) Error() string

type Pointer

type Pointer uint32
const NullPointer Pointer = 0

type ResourceOwner

type ResourceOwner interface {
	Free(ctx context.Context, api *API) error
}

type StreamEntry

type StreamEntry struct {
	Packed streamEntryPacked
	// contains filtered or unexported fields
}

type UpdateAddCommand

type UpdateAddCommand struct {
	SourcePath string
	TargetPath string
	ConfigFile *string
	Flags      int32
}

func (UpdateAddCommand) WriterTo

func (c UpdateAddCommand) WriterTo(ctx context.Context, api *API) (io.WriterTo, error)

type UpdateDeleteCommand

type UpdateDeleteCommand struct {
	Path  string
	Flags int32
}

type UpdateOp

type UpdateOp int32
const (
	UpdateOpAdd UpdateOp = iota
	UpdateOpDelete
	UpdateOpRename
)

type UpdateRenameCommand

type UpdateRenameCommand struct {
	SourcePath string
	TargetPath string
	// contains filtered or unexported fields
}

type WimlibError

type WimlibError int

func (WimlibError) Error

func (err WimlibError) Error() string

type WriterToProvider

type WriterToProvider interface {
	WriterTo(ctx context.Context, api *API) (io.WriterTo, error)
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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