{"id":13439440,"url":"https://github.com/webdesus/fs_extra","last_synced_at":"2025-12-30T02:50:56.239Z","repository":{"id":17151597,"uuid":"81253511","full_name":"webdesus/fs_extra","owner":"webdesus","description":"Expanding opportunities standard library std::fs and std::io","archived":false,"fork":false,"pushed_at":"2023-12-13T11:37:26.000Z","size":151,"stargazers_count":308,"open_issues_count":45,"forks_count":49,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-07T13:15:55.337Z","etag":null,"topics":["copy","filesystem","library","move","progress","recursion","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webdesus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-07T20:58:15.000Z","updated_at":"2025-03-02T09:22:15.000Z","dependencies_parsed_at":"2024-06-18T16:26:44.996Z","dependency_job_id":"b8b2132e-ebb1-4a0f-99f4-04bac463f015","html_url":"https://github.com/webdesus/fs_extra","commit_stats":{"total_commits":78,"total_committers":12,"mean_commits":6.5,"dds":0.3076923076923077,"last_synced_commit":"1754296075e7cc4a25feaa876a3f4b9daccc0b98"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webdesus%2Ffs_extra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webdesus%2Ffs_extra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webdesus%2Ffs_extra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webdesus%2Ffs_extra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webdesus","download_url":"https://codeload.github.com/webdesus/fs_extra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244577634,"owners_count":20475340,"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","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":["copy","filesystem","library","move","progress","recursion","rust"],"created_at":"2024-07-31T03:01:13.935Z","updated_at":"2025-12-12T16:56:36.124Z","avatar_url":"https://github.com/webdesus.png","language":"Rust","readme":"# fs_extra\n\nA Rust library that provides additional functionality not present in [`std::fs`](https://doc.rust-lang.org/std/fs/index.html).\n\n[![Build Status](https://travis-ci.org/webdesus/fs_extra.svg)](https://travis-ci.org/webdesus/fs_extra)\n[![Crates.io Status](https://img.shields.io/crates/v/fs_extra.svg)](https://crates.io/crates/fs_extra)\n[![Docs](https://docs.rs/fs_extra/badge.svg)](https://docs.rs/fs_extra)\n\n[Documentation](https://docs.rs/fs_extra)\n\n[Migrations to 1.x.x version](https://github.com/webdesus/fs_extra/wiki/Migrations-to-1.x.x-version)\n\n\n## Key features:\n\n* Copy files (optionally with information about the progress).\n\n* Copy directories recursively (optionally with information about the progress).\n\n* Move files (optionally with information about the progress).\n\n* Move directories recursively (optionally with information about the progress).\n\n* A single method for create and write `String` content in file.\n\n* A single method for open and read `String` content from file.\n\n* Get folder size\n\n* Get collection of directory entries \n\n## Functions:\n\n| Function | Description |\n| ------------- | ------------- |\n| [fs_extra::copy_items](https://docs.rs/fs_extra/*/fs_extra/fn.copy_items.html)  | Recursively copies files and directories from one location to another |\n| [fs_extra::copy_items_with_progress](https://docs.rs/fs_extra/*/fs_extra/fn.copy_items_with_progress.html)  | Recursively copies files and directories from one location to another with information about progress |\n| [fs_extra::move_items](https://docs.rs/fs_extra/*/fs_extra/fn.move_items.html)  | Recursively moves files and directories from one location to another |\n| [fs_extra::move_items_with_progress](https://docs.rs/fs_extra/*/fs_extra/fn.move_items_with_progress.html)  | Recursively moves files and directories from one location to another with information about progress |\n| [fs_extra::remove_items](https://docs.rs/fs_extra/*/fs_extra/fn.remove_items.html)  | Removes files or directories |\n| [fs_extra::file::copy](https://docs.rs/fs_extra/*/fs_extra/file/fn.copy.html)  | Copies the contents of one file to another |\n| [fs_extra::file::copy_with_progress](https://docs.rs/fs_extra/*/fs_extra/file/fn.copy_with_progress.html)  | Copies the contents of one file to another with information about progress  |\n| [fs_extra::file::move_file](https://docs.rs/fs_extra/*/fs_extra/file/fn.move_file.html)  | Moves a file from one location to another  |\n| [fs_extra::file::move_file_with_progress](https://docs.rs/fs_extra/*/fs_extra/file/fn.move_file_with_progress.html)  | Moves a file from one location to another with information about progress  |\n| [fs_extra::file::remove](https://docs.rs/fs_extra/*/fs_extra/file/fn.remove.html)  | Removes a file |\n| [fs_extra::file::read_to_string](https://docs.rs/fs_extra/*/fs_extra/file/fn.read_to_string.html)  | Reads file content into a `String` |\n| [fs_extra::file::write_all](https://docs.rs/fs_extra/*/fs_extra/file/fn.write_all.html)  | Writes `String` content to a file  |\n| [fs_extra::dir::create](https://docs.rs/fs_extra/*/fs_extra/dir/fn.create.html)  | Creates a new, empty directory at the given path  |\n| [fs_extra::dir::create_all](https://docs.rs/fs_extra/*/fs_extra/dir/fn.create_all.html)  | Recursively creates a directory and all of its parent components if they are missing  |\n| [fs_extra::dir::copy](https://docs.rs/fs_extra/*/fs_extra/dir/fn.copy.html)  | Recursively copies the directory contents from one location to another |\n| [fs_extra::dir::copy_with_progress](https://docs.rs/fs_extra/*/fs_extra/dir/fn.copy_with_progress.html)  | Recursively copies the directory contents from one location to another with information about progress |\n| [fs_extra::dir::move_dir](https://docs.rs/fs_extra/*/fs_extra/dir/fn.move_dir.html)  | Moves directory contents from one location to another |\n| [fs_extra::dir::move_dir_with_progress](https://docs.rs/fs_extra/*/fs_extra/dir/fn.move_dir_with_progress.html)  | Moves directory contents from one location to another with information about progress  |\n| [fs_extra::dir::remove](https://docs.rs/fs_extra/*/fs_extra/dir/fn.remove.html)  | Removes directory  |\n| [fs_extra::dir::get_size](https://docs.rs/fs_extra/*/fs_extra/dir/fn.get_size.html)  | Returns the size of the file or directory  |\n| [fs_extra::dir::get_dir_content](https://docs.rs/fs_extra/*/fs_extra/dir/fn.get_dir_content.html)  | Gets details such as the size and child items of a directory |\n| [fs_extra::dir::get_dir_content2](https://docs.rs/fs_extra/*/fs_extra/dir/fn.get_dir_content2.html)  | Gets details such as the size and child items of a directory using specified settings |\n| [fs_extra::dir::get_details_entry](https://docs.rs/fs_extra/*/fs_extra/dir/fn.get_details_entry.html)  | Gets attributes of a directory entry |\n| [fs_extra::dir::ls](https://docs.rs/fs_extra/*/fs_extra/dir/fn.ls.html)  | Gets attributes of directory entries in a directory |\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n```toml\n[dependencies]\nfs_extra = \"1.3.0\"\n```\n## Examples\n\nThe following example shows how to copy a directory recursively and display progress. First a source directory `./temp/dir` containing file `test1.txt` and a subdirectory `sub` is createad with `sub` itself having a file `test2.txt`. `./temp/dir` and all contents are then copied out to `./out/dir`.\n\n```rust\nuse std::path::Path;\nuse std::{thread, time};\nuse std::sync::mpsc::{self, TryRecvError};\n\nextern crate fs_extra;\nuse fs_extra::dir::*;\nuse fs_extra::error::*;\n\nfn example_copy() -\u003e Result\u003c()\u003e {\n\n    let path_from = Path::new(\"./temp\");\n    let path_to = path_from.join(\"out\");\n    let test_folder = path_from.join(\"test_folder\");\n    let dir = test_folder.join(\"dir\");\n    let sub = dir.join(\"sub\");\n    let file1 = dir.join(\"file1.txt\");\n    let file2 = sub.join(\"file2.txt\");\n\n    create_all(\u0026sub, true)?;\n    create_all(\u0026path_to, true)?;\n    fs_extra::file::write_all(\u0026file1, \"content1\")?;\n    fs_extra::file::write_all(\u0026file2, \"content2\")?;\n\n    assert!(dir.exists());\n    assert!(sub.exists());\n    assert!(file1.exists());\n    assert!(file2.exists());\n\n\n    let mut options = CopyOptions::new();\n    options.buffer_size = 1;\n    let (tx, rx) = mpsc::channel();\n    thread::spawn(move || {\n        let handler = |process_info: TransitProcess| {\n            tx.send(process_info).unwrap();\n            thread::sleep(time::Duration::from_millis(500));\n            fs_extra::dir::TransitProcessResult::ContinueOrAbort\n        };\n        copy_with_progress(\u0026test_folder, \u0026path_to, \u0026options, handler).unwrap();\n    });\n\n    loop {\n        match rx.try_recv() {\n            Ok(process_info) =\u003e {\n                println!(\"{} of {} bytes\",\n                         process_info.copied_bytes,\n                         process_info.total_bytes);\n            }\n            Err(TryRecvError::Disconnected) =\u003e {\n                println!(\"finished\");\n                break;\n            }\n            Err(TryRecvError::Empty) =\u003e {}\n        }\n    }\n    Ok(())\n\n}\nfn main() {\n    example_copy();\n}\n```\n","funding_links":[],"categories":["Libraries","Rust","库 Libraries","库"],"sub_categories":["Filesystem","文件系统 Filesystem","文件系统"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebdesus%2Ffs_extra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebdesus%2Ffs_extra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebdesus%2Ffs_extra/lists"}