Expand description
A Rust library to help interacting with cache directories and CACHEDIR.TAG
files as defined
in Cache Directory Tagging Specification.
The abstract of the spefication should be more than enough to illustrate what we’re doing here:
Many applications create and manage directories containing cached information about content stored elsewhere, such as cached Web content or thumbnail-size versions of images or movies. For speed and storage efficiency we would often like to avoid backing up, archiving, or otherwise unnecessarily copying such directories around, but it is a pain to identify and individually exclude each such directory during data transfer operations. I propose an extremely simple convention by which applications can reliably “tag” any cache directories they create, for easy identification by backup systems and other data management utilities. Data management utilities can then heed or ignore these tags as the user sees fit.
Enums
- The state of a
CACHEDIR.TAG
file.
Constants
- The
CACHEDIR.TAG
file header as defined by the specification.
Functions
- Adds a tag to the specified
directory
. - Ensures the tag exists in
directory
. - Gets the state of the tag in the specified directory.
- Returns
true
if the tag is present atdirectory
,false
otherwise. - Tries to create
directory
with aCACHEDIR.TAG
file atomically and returnstrue
if it created it orfalse
if the directory already exists, regardless of if theCACHEDIR.TAG
file exists in it or if it has the correct header.