...
Documentation
Documentation

# Package mscfb

## Overview ▹

## Overview ▾

## Index ▹

## Index ▾

### Package files

file.go mscfb.go

## Constants

    const (
        // ErrFormat reports issues with the MSCFB's header structures
        ErrFormat = iota
        // ErrRead reports issues attempting to read MSCFB streams
        ErrRead
        // ErrSeek reports seek issues
        ErrSeek
        // ErrWrite reports write issues
        ErrWrite
        // ErrTraverse reports issues attempting to traverse the child-parent-sibling relations
        // between MSCFB storage objects
        ErrTraverse
    )

## type Error ¶

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

### func (Error) Error ¶

    func (e Error) Error() string

### func (Error) Typ ¶

    func (e Error) Typ() int

Typ gives the type of MSCFB error

## type File ¶

File represents a MSCFB directory entry

    type File struct {
        Name    string   // stream or directory name
        Initial uint16   // the first character in the name (identifies special streams such as MSOLEPS property sets)
        Path    []string // file path
        Size    int64    // size of stream
        // contains filtered or unexported fields
    }

### func (*File) Created ¶

    func (f *File) Created() time.Time

Created returns this directory entry's created field

### func (*File) FileInfo ¶

    func (f *File) FileInfo() os.FileInfo

FileInfo for this directory entry. Useful for IsDir() (whether a directory entry is a stream (file) or a storage object (dir))

### func (*File) ID ¶

    func (f *File) ID() string

ID returns this directory entry's CLSID field

### func (*File) Modified ¶

    func (f *File) Modified() time.Time

Created returns this directory entry's modified field

### func (*File) Read ¶

    func (f *File) Read(b []byte) (int, error)

Read this directory entry Returns 0, io.EOF if no stream is available (i.e. for a storage object)

### func (*File) ReadAt ¶

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

ReadAt reads p bytes at the offset off from the start of the file. Does not affect seek place for other reads/writes.

### func (*File) Seek ¶

    func (f *File) Seek(offset int64, whence int) (int64, error)

Seek sets the offset for the next Read or Write to offset, interpreted according to whence: 0 means relative to the start of the file, 1 means relative to the current offset, and 2 means relative to the end. Seek returns the new offset relative to the start of the file and an error, if any.

### func (*File) SetEntryContent ¶

    func (f *File) SetEntryContent(b []byte) error

SetEntryContent replaces the whole file bytes for the provided ones. It resets an offset, remaining bytes to read and the current sector.

### func (*File) Write ¶

    func (f *File) Write(b []byte) (int, error)

Write to this directory entry Depends on the io.ReaderAt supplied to mscfb.New() being a WriterAt too Returns 0, io.EOF if no stream is available (i.e. for a storage object)

### func (*File) WriteAt ¶

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

WriteAt writes p bytes to the offset off from the start of the file. Does not affect seek place for other reads/writes.

## type Reader ¶

Reader provides sequential access to the contents of a MS compound file (MSCFB)

    type Reader struct {
        File []*File // File is an ordered slice of final directory entries.
        // contains filtered or unexported fields
    }

### func New ¶

    func New(ra io.ReaderAt) (*Reader, error)

New returns a MSCFB reader

### func (*Reader) Created ¶

    func (r *Reader) Created() time.Time

Created returns the created field from the root directory entry

### func (*Reader) Debug ¶

    func (r *Reader) Debug() map[string][]uint32

Debug provides granular information from an mscfb file to assist with debugging

### func (*Reader) Export ¶

    func (r *Reader) Export() ([]byte, error)

Export makes a byte array from a Reader for saving it to a bin file.

### func (*Reader) GetEntry ¶

    func (r *Reader) GetEntry(entryName string) (*File, error)

GetEntry finds the entry for given entry name

### func (*Reader) GetHeader ¶

    func (r *Reader) GetHeader() *header

### func (*Reader) ID ¶

    func (r *Reader) ID() string

ID returns the CLSID (class ID) field from the root directory entry

### func (*Reader) Modified ¶

    func (r *Reader) Modified() time.Time

Modified returns the last modified field from the root directory entry

### func (*Reader) Next ¶

    func (r *Reader) Next() (*File, error)

Next iterates to the next directory entry. This isn't necessarily an adjacent *File within the File slice, but is based on the Left Sibling, Right Sibling and Child information in directory entries.

### func (*Reader) Read ¶

    func (r *Reader) Read(b []byte) (n int, err error)

Read the current directory entry

## Subdirectories

Name | Synopsis
--- | ---
..