Saucexages v0.2.0 Saucexages.IO.FileWriter View Source
Functions for writing and maintaining SAUCE files.
This writer is primarily for working with larger files. You may elect to use Saucexages.IO.BinaryWriter
if you want a more flexible writer, provided that your files are small and fit in memory.
The general approach this writer takes is to be pragmatic about what is and is not a SAUCE and where according to the SAUCE spec data should be located. The general strategy of this writer is to avoid costly seeks and rewrites of very large files. Instead, the writer generally tries to perform most operations from a SAUCE-centric point-of-view. That is, most operations are focused on scanning backwards through a file in a deterministic, constant way.
A good example of pragmatic behavior is how this writer deals with EOF characters. For example, according to the SAUCE spec, a SAUCE should always be written after an EOF character. This does not mean that the SAUCE will be immediately after the EOF. To avoid scanning entire large files, we merely check for the presence of an EOF character relative to the SAUCE block. If an EOF character is not before the SAUCE block, we insert one. This can result in an extra byte written, but with the benefit that seeking through the whole file is no longer necessary.
Link to this section Summary
Functions
Removes any comments, if present from a SAUCE and rewrites the SAUCE accordingly
Removes a SAUCE record from a file
Writes the given SAUCE info to the file at the given path
Link to this section Functions
Removes any comments, if present from a SAUCE and rewrites the SAUCE accordingly.
Can be used to remove a SAUCE comments block or to clean erroneous comment information such as mismatched comment lines or double comment blocks.
Removes a SAUCE record from a file.
Both the SAUCE record and comments block will be removed.
write(Path.t(), Saucexages.SauceBlock.t()) :: :ok
Writes the given SAUCE info to the file at the given path
.