TmpFile
is an object representing a temporary file that can optionally be
persisted to a new location.
This library was created to provide a prepackaged solution where:
- An application wants to write a new (temporary) file, but wants it to be automatically removed if not explicitly requested to persist. (For instance, receive a file over network, and automatically remove it if the connection is lost before the entire file could be received).
- The contents of a file is inspected as it is being received. (For instance, while receiving a file over a network, calculate the file's hash as it is being received).
- An application may want the file to be written to a temporary location, and only moved to its permanent name once the entire file has been received. (For instance, the name of the file may be its hash, which is unavailable until the entire file has been processed).
- A small file isn't written to the file system at all, and is returned as a memory buffer instead.
Feature labels in documentation
The crate's documentation uses automatically generated feature labels, which currently requires nightly featuers. To build the documentation locally use:
RUSTFLAGS="--cfg docsrs" RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features
Change log
The details of changes can always be found in the timeline, but for a high-level view of changes between released versions there's a manually maintained Change Log.
Project Status
tmpfile is in early development stages.