Documentation ¶
Overview ¶
Package mscfb implements a reader for Microsoft's Compound File Binary File Format (http://msdn.microsoft.com/en-us/library/dd942138.aspx).
The Compound File Binary File Format is also known as the Object Linking and Embedding (OLE) or Component Object Model (COM) format and was used by many early MS software such as MS Office.
Example:
file, _ := os.Open("test/test.doc") defer file.Close() doc, err := mscfb.New(file) if err != nil { log.Fatal(err) } for entry, err := doc.Next(); err == nil; entry, err = doc.Next() { buf := make([]byte, 512) i, _ := entry.Read(buf) if i > 0 { fmt.Println(buf[:i]) } fmt.Println(entry.Name) }
Index ¶
- Constants
- type Error
- type File
- func (f *File) Created() time.Time
- func (f *File) FileInfo() os.FileInfo
- func (f *File) ID() string
- func (f *File) Modified() time.Time
- func (f *File) Read(b []byte) (int, error)
- func (f *File) ReadAt(p []byte, off int64) (n int, err error)
- func (f *File) Seek(offset int64, whence int) (int64, error)
- func (f *File) Write(b []byte) (int, error)
- func (f *File) WriteAt(p []byte, off int64) (n int, err error)
- type Reader
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 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
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 }
File represents a MSCFB directory entry
func (*File) FileInfo ¶
FileInfo for this directory entry. Useful for IsDir() (whether a directory entry is a stream (file) or a storage object (dir))
func (*File) Read ¶
Read this directory entry Returns 0, io.EOF if no stream is available (i.e. for a storage object)
func (*File) ReadAt ¶
ReadAt reads p bytes at offset off from start of file. Does not affect seek place for other reads/writes.
func (*File) Seek ¶
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.
type Reader ¶
type Reader struct { File []*File // File is an ordered slice of final directory entries. // contains filtered or unexported fields }
Reader provides sequential access to the contents of a MS compound file (MSCFB)
func (*Reader) Debug ¶
Debug provides granular information from an mscfb file to assist with debugging