Stebalien/tempfile


Temporary file library for rust

http://stebalien.com/projects/tempfile-rs

License: Other

Language: Rust

Keywords: filesystem-library, library, rust, tempfile, testing


tempfile

Crate Build Status Build status

A secure, cross-platform, temporary file library for Rust. In addition to creating temporary files, this library also allows users to securely open multiple independent references to the same temporary file (useful for consumer/producer patterns and surprisingly difficult to implement securely).

Documentation

Usage

Minimum required Rust version: 1.24.0

Add this to your Cargo.toml:

[dependencies]
tempfile = "3"

...and this to your crate root:

extern crate tempfile;

Example

extern crate tempfile;
use std::fs::File;
use std::io::{Write, Read, Seek, SeekFrom};

fn main() {
    // Write
    let mut tmpfile: File = tempfile::tempfile().unwrap();
    write!(tmpfile, "Hello World!").unwrap();

    // Seek to start
    tmpfile.seek(SeekFrom::Start(0)).unwrap();

    // Read
    let mut buf = String::new();
    tmpfile.read_to_string(&mut buf).unwrap();
    assert_eq!("Hello World!", buf);
}

Project Statistics

Sourcerank 17
Repository Size 13.7 MB
Stars 249
Forks 32
Watchers 9
Open issues 5
Dependencies 3
Contributors 22
Tags 17
Created
Last updated
Last pushed

Top Contributors See all

Steven Allen Ashley Mannix Jason White Jon Gjengset Noah Levitt Peter Atashian Matt Brubeck oliverhenshaw Bastien Dejean Igor Gnatenko κeen Alex Gaynor Cody Schafer Ian Douglas Scott Rett Berg Aaron Power Bastien Orivel Tshepang Lekhonkhobe Alex Crichton Jeremy Soller

Packages Referencing this Repo

tempfile
A library for managing temporary files and directories.
Latest release 3.0.8 - Updated - 249 stars

Recent Tags See all

v3.0.8 May 19, 2019
v3.0.7 February 17, 2019
v3.0.6 February 06, 2019
v3.0.5 November 26, 2018
v3.0.4 September 14, 2018
v3.0.3 July 17, 2018
v3.0.2 May 10, 2018
v3.0.1 April 17, 2018
v3.0.0 March 25, 2018
v2.2.0 September 26, 2017
v2.1.6 July 16, 2017
v2.1.5 January 19, 2017
v2.1.4 June 14, 2016
v2.1.3 April 21, 2016
v2.1.1 February 17, 2016

Something wrong with this page? Make a suggestion

Last synced: 2019-05-19 02:30:35 UTC

Login to resync this repository