#temporary-files #temp-file #persistent #persist #storage #intended

tmpfile

A temporary file writer with an option to persist

2 releases

0.0.2 Jan 29, 2024
0.0.1 Jan 25, 2024

#520 in Filesystem

Download history 2/week @ 2024-01-20 16/week @ 2024-01-27 18/week @ 2024-02-17 24/week @ 2024-02-24 1/week @ 2024-03-02 116/week @ 2024-03-30 877/week @ 2024-04-06 736/week @ 2024-04-13 1039/week @ 2024-04-20

2,768 downloads per month
Used in fsblobstore

0BSD license

14KB
242 lines

tmpfile

TmpFile is an object representing a temporary file that can optionally be persisted.


lib.rs:

Representation of a temporary file that can be persisted.

This is intended to be used in an application that needs to receive a file to persistent storage, but doesn't know its final target file name until it has received the entire file (such as if the file's name should be its content's hash).

Minimum size

In some cases an application may not want to store small files in its filesystem based data store. For this purpose, the TmpFile can be set up to have a minimum file size. If a TmpFile does not reach this size before being persisted, a buffer of the file's contents will be returned instead of a file name of the persisted file.

The [TmpFile::with_minsize()] factory method can be used to use this feature.

Dependencies

~0–5.5MB