{"id":13439445,"url":"https://github.com/rust-lang-deprecated/tempdir","last_synced_at":"2025-12-12T16:57:05.099Z","repository":{"id":28224147,"uuid":"31728565","full_name":"rust-lang-deprecated/tempdir","owner":"rust-lang-deprecated","description":"Temporary directory management for Rust","archived":true,"fork":false,"pushed_at":"2019-09-03T21:37:02.000Z","size":786,"stargazers_count":140,"open_issues_count":2,"forks_count":24,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-09-25T22:57:28.415Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://doc.rust-lang.org/tempdir","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rust-lang-deprecated.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-05T18:16:06.000Z","updated_at":"2025-08-28T22:06:53.000Z","dependencies_parsed_at":"2022-09-04T16:51:18.956Z","dependency_job_id":null,"html_url":"https://github.com/rust-lang-deprecated/tempdir","commit_stats":null,"previous_names":["rust-lang/tempdir"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rust-lang-deprecated/tempdir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang-deprecated%2Ftempdir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang-deprecated%2Ftempdir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang-deprecated%2Ftempdir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang-deprecated%2Ftempdir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-lang-deprecated","download_url":"https://codeload.github.com/rust-lang-deprecated/tempdir/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang-deprecated%2Ftempdir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27686656,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:13.978Z","updated_at":"2025-12-12T16:57:05.049Z","avatar_url":"https://github.com/rust-lang-deprecated.png","language":"Rust","funding_links":[],"categories":["Libraries","库 Libraries","库"],"sub_categories":["Filesystem","文件系统 Filesystem","文件系统"],"readme":"tempdir\n=======\n\nA Rust library for creating a temporary directory and deleting its entire\ncontents when the directory is dropped.\n\n[![Build Status](https://travis-ci.org/rust-lang-nursery/tempdir.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/tempdir)\n[![Build status](https://ci.appveyor.com/api/projects/status/2mp24396db5t4hul/branch/master?svg=true)](https://ci.appveyor.com/project/rust-lang-libs/tempdir/branch/master)\n\n[Documentation](https://doc.rust-lang.org/tempdir)\n\n## Deprecation Note\n\nThe `tempdir` crate is being merged into [`tempfile`](https://github.com/Stebalien/tempfile) and is available in `3.x`. Please direct new issues and pull requests to `tempfile`.\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\ntempdir = \"0.3\"\n```\n\nand this to your crate root:\n\n```rust\nextern crate tempdir;\n```\n\n## Example\n\nThis sample method does the following:\n\n1. Create a temporary directory in the default location with the given prefix.\n2. Determine a file path in the directory and print it out.\n3. Create a file inside the temp folder.\n4. Write to the file and sync it to disk.\n5. Close the directory, deleting the contents in the process.\n\n```rust\nuse std::io::{self, Write};\nuse std::fs::File;\nuse tempdir::TempDir;\n\nfn write_temp_folder_with_files() -\u003e io::Result\u003c()\u003e {\n    let dir = TempDir::new(\"my_directory_prefix\")?;\n    let file_path = dir.path().join(\"foo.txt\");\n    println!(\"{:?}\", file_path);\n\n    let mut f = File::create(file_path)?;\n    f.write_all(b\"Hello, world!\")?;\n    f.sync_all()?;\n    dir.close()?;\n\n    Ok(())\n}\n```\n\n**Note:** Closing the directory is actually optional, as it would be done on\ndrop. The benefit of closing here is that it allows possible errors to be\nhandled.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-lang-deprecated%2Ftempdir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-lang-deprecated%2Ftempdir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-lang-deprecated%2Ftempdir/lists"}