CompoundFile.Reader (compound_file v0.1.0)

View Source

Reader for Compound File Binary (CFB) formatted files.

This module is in its infancy, and will respond to errors in the file by crashing. If you are going to use this module, please assume that some point in the future these functions will return {:error, reason} instead of crashing.

It is also very, very slow working with large files.

Please contribute to the project if you'd like to use this module in production!

Summary

Functions

Get the data of a file by using its file entry.

List all files in a compound file.

Functions

file_data(bin, entry)

@spec file_data(binary(), CompoundFile.Reader.FileEntry.t()) :: {:ok, binary()}

Get the data of a file by using its file entry.

Note that passing invalid CFB files to this function will result in an exception or unpredictable behavior.

You can get a file entry by calling CompoundFile.Reader.files/1.

Returns {:ok, binary} with the file data.

files(bin)

@spec files(binary()) :: {:ok, [CompoundFile.Reader.FileEntry.t()]}

List all files in a compound file.

Note that passing invalid CFB files to this function will result in an exception or unpredictable behavior.

Returns {:ok, [FileEntry.t()]} with a list of file entries.

Use CompoundFile.Reader.file_data/2 to get the data from a file entry.