sparsebundle

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: GPL-2.0 Imports: 5 Imported by: 0

README

go-sparsebundle

Direct access to the sparse bundle format using golang using cgo.

This library is a wrapper on top of the already existing

https://github.com/gyf304/sparsebundle-fuse due to that the software is GPLv2.

How to use

bbundle, err := Open("./tests/test.sparsebundle", 16)
if err != nil {
    panic(err)
}
defer b.Close()

// bundle implements:
// * io.ReadWriteSeeker
// * io.ReaderAt
// * io.WriterAt
// * io.Closer

Test

There are two test files

  • tests/empty.sparsebundle an empty sparse bundle
  • tests/test.sparsebundle an encrypted sparse bundle with a single file in it

Documentation

Overview

sparsebundle implements a reader writer seeker closer for macOS sparse bundle format.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWhence       = errors.New("Seek: invalid whence")
	ErrOffset       = errors.New("Seek: invalid offset")
	ErrMaxOpenBands = errors.New("maxOpenBands have to be at least 10")
	ErrNotOpen      = errors.New("bundle not opened")
)

Functions

This section is empty.

Types

type Bundle

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

Implements the

func Open

func Open(path string, maxOpenBands int) (*Bundle, error)

func (*Bundle) Close

func (b *Bundle) Close() error

Close closes the bundle and frees the resources

func (*Bundle) Err

func (b *Bundle) Err() error

func (*Bundle) Flush

func (b *Bundle) Flush() error

Flush flushes everything to disk

func (*Bundle) Read

func (b *Bundle) Read(p []byte) (n int, err error)

Read as in io.Reader

func (*Bundle) ReadAt

func (b *Bundle) ReadAt(p []byte, off int64) (n int, err error)

ReadAt as in io.ReaderAt

func (*Bundle) Seek

func (b *Bundle) Seek(offset int64, whence int) (int64, error)

Seek as in io.Seeker

func (*Bundle) Size

func (b *Bundle) Size() int64

Size returns the byte size for the bundle

func (*Bundle) Trim

func (b *Bundle) Trim(size int) (n int, err error)

Trim will remove size data at seeked position

func (*Bundle) Write

func (b *Bundle) Write(p []byte) (n int, err error)

Write as in io.Writer

func (*Bundle) WriteAt

func (b *Bundle) WriteAt(p []byte, off int64) (n int, err error)

WriteAt as in io.WriterAt

Jump to

Keyboard shortcuts

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