Hi everyone,
I made three Julia packages to deal with formatted data: Formats [1], FormatCodecs [2], and FormatStreams [3]. I initially used FileIO [4] for that purpose, but its centralized nature caused me several problems, such as filename extensions shared by several formats, or the save code trying to infer format from an existing file [5]. I decided to try a completely different approach based on MIME types packages registering the formats they support when they are loaded (instead of a central database approach). I think a similar redisign of FileIO was proposed previously [6]. Depending on the community’s interest, we could merge Formats and FileIO?
From the README:
Formats
provides functions to guess
and to specify
the format (e.g. image/png
) and, optionally, the coding (e.g. application/gzip
) associated with a filename or an IO stream. The Formatted
objects created by these functions can be passed to the standard IO functions open
, close
, read
and write
. Three convenience functions are also provided for interactive use; openf
, readf
and writef
behave like their counterparts from the Base
module, but also detect formatted data automatically. Package developers can integrate their IO routines with Formats by specializing functions and registering the formats or codings they support. If multiple loaded packages support the same formats, a “favorite” system allows choosing a reader/writer. Formats also reports ambiguities, such as multiple formats using the same filename extension.
The other two packages, FormatCodecs and FormatStreams allow reading/writing compressed files and streams of formatted objects.
I use these three packages for IO in Dorothy [7], another package I am developping for the analysis and manipulation of molecular structures. This last package is not documented yet, however.
Cheers,
Olivier
[1] https://github.com/ofisette/Formats.jl
[2] https://github.com/ofisette/FormatCodecs.jl
[3] https://github.com/ofisette/FormatStreams.jl
[4] https://github.com/JuliaIO/FileIO.jl
[5] https://github.com/JuliaIO/FileIO.jl/issues/132
[6] https://github.com/JuliaIO/FileIO.jl/issues/189
[7] https://github.com/ofisette/Dorothy.jl