All Projects → webdesus → Fs_extra

webdesus / Fs_extra

Licence: mit
Expanding opportunities standard library std::fs and std::io

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Fs extra

Node Fs Extra
Node.js: extra methods for the fs object like copy(), remove(), mkdirs()
Stars: ✭ 8,142 (+8470.53%)
Mutual labels:  copy, filesystem, move
Renamer
Rename files in bulk.
Stars: ✭ 240 (+152.63%)
Mutual labels:  filesystem, move
Pdf Lib
Create and modify PDF documents in any JavaScript environment
Stars: ✭ 3,426 (+3506.32%)
Mutual labels:  copy, library
Xcv
✂️ Cut, Copy and Paste files with Bash
Stars: ✭ 144 (+51.58%)
Mutual labels:  copy, filesystem
Python Progressbar
Progressbar 2 - A progress bar for Python 2 and Python 3 - "pip install progressbar2"
Stars: ✭ 682 (+617.89%)
Mutual labels:  library, progress
Copy Webpack Plugin
Copy files and directories with webpack
Stars: ✭ 2,679 (+2720%)
Mutual labels:  copy, filesystem
Move To Library Sketchplugin
You can now move symbol from your project to any library and re-attach all the symbol instances to this library. also it keep the overrides without any problems and it work with abstract that have libraries not in your local machine
Stars: ✭ 174 (+83.16%)
Mutual labels:  library, move
Theglowingloader
TheGlowingLoader is the highly configurable library to indicate progress and is natively created for Android Platform. It is an implementation of a design composed by Shashank Sahay.
Stars: ✭ 379 (+298.95%)
Mutual labels:  library, progress
Fcfilemanager
iOS File Manager on top of NSFileManager for simplifying files management. 📂
Stars: ✭ 862 (+807.37%)
Mutual labels:  copy, move
Funnyloader
Loading indicator for android with over 200 random messages
Stars: ✭ 77 (-18.95%)
Mutual labels:  library, progress
Amazon Alexa Php
Php library for amazon echo (alexa) skill development.
Stars: ✭ 93 (-2.11%)
Mutual labels:  library
Xlcircleprogress
iOS 圆环进度指示器
Stars: ✭ 93 (-2.11%)
Mutual labels:  progress
Logsip
A simple, concise, colorful logger for Go
Stars: ✭ 94 (-1.05%)
Mutual labels:  library
Windowshowdemo
Android 弹窗案例总结(仿淘宝弹窗 咸鱼菜单 筛选列表)
Stars: ✭ 95 (+0%)
Mutual labels:  progress
Discord.jl
The Julia Discord API Wrapper
Stars: ✭ 93 (-2.11%)
Mutual labels:  library
Cocsharp
Clash of Clans library, proxy and server written in .NET [Unmaintained]
Stars: ✭ 94 (-1.05%)
Mutual labels:  library
Raisincss
An Utility CSS only library. It supports css grid and many more useful css properties.
Stars: ✭ 93 (-2.11%)
Mutual labels:  library
Breaker
🚧 Flexible mechanism to make execution flow interruptible.
Stars: ✭ 93 (-2.11%)
Mutual labels:  library
Angular Librarian
An Angular 2+ scaffolding setup for creating libraries
Stars: ✭ 92 (-3.16%)
Mutual labels:  library
Cloudcmd
✨☁️📁✨ Cloud Commander file manager for the web with console and editor.
Stars: ✭ 1,332 (+1302.11%)
Mutual labels:  filesystem

fs_extra

A Rust library that provides additional functionality not present in std::fs.

Build Status Crates.io Status Docs

Documentation

Migrations to 1.x.x version

Key features:

  • Copy files (optionally with information about the progress).

  • Copy directories recursively (optionally with information about the progress).

  • Move files (optionally with information about the progress).

  • Move directories recursively (optionally with information about the progress).

  • A single method for create and write String content in file.

  • A single method for open and read String content from file.

  • Get folder size

  • Get collection of directory entries

Functions:

Function Description
fs_extra::copy_items Recursively copies files and directories from one location to another
fs_extra::copy_items_with_progress Recursively copies files and directories from one location to another with information about progress
fs_extra::move_items Recursively moves files and directories from one location to another
fs_extra::move_items_with_progress Recursively moves files and directories from one location to another with information about progress
fs_extra::remove_items Removes files or directories
fs_extra::file::copy Copies the contents of one file to another
fs_extra::file::copy_with_progress Copies the contents of one file to another with information about progress
fs_extra::file::move_file Moves a file from one location to another
fs_extra::file::move_file_with_progress Moves a file from one location to another with information about progress
fs_extra::file::remove Removes a file
fs_extra::file::read_to_string Reads file content into a String
fs_extra::file::write_all Writes String content to a file
fs_extra::dir::create Creates a new, empty directory at the given path
fs_extra::dir::create_all Recursively creates a directory and all of its parent components if they are missing
fs_extra::dir::copy Recursively copies the directory contents from one location to another
fs_extra::dir::copy_with_progress Recursively copies the directory contents from one location to another with information about progress
fs_extra::dir::move_dir Moves directory contents from one location to another
fs_extra::dir::move_dir_with_progress Moves directory contents from one location to another with information about progress
fs_extra::dir::remove Removes directory
fs_extra::dir::get_size Returns the size of the file or directory
fs_extra::dir::get_dir_content Gets details such as the size and child items of a directory
fs_extra::dir::get_dir_content2 Gets details such as the size and child items of a directory using specified settings
fs_extra::dir::get_details_entry Gets attributes of a directory entry
fs_extra::dir::ls Gets attributes of directory entries in a directory

Usage

Add this to your Cargo.toml:

[dependencies]
fs_extra = "1.2.0"

Examples

The 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.

use std::path::Path;
use std::{thread, time};
use std::sync::mpsc::{self, TryRecvError};

extern crate fs_extra;
use fs_extra::dir::*;
use fs_extra::error::*;

fn example_copy() -> Result<()> {

    let path_from = Path::new("./temp");
    let path_to = path_from.join("out");
    let test_folder = path_from.join("test_folder");
    let dir = test_folder.join("dir");
    let sub = dir.join("sub");
    let file1 = dir.join("file1.txt");
    let file2 = sub.join("file2.txt");

    create_all(&sub, true)?;
    create_all(&path_to, true)?;
    fs_extra::file::write_all(&file1, "content1")?;
    fs_extra::file::write_all(&file2, "content2")?;

    assert!(dir.exists());
    assert!(sub.exists());
    assert!(file1.exists());
    assert!(file2.exists());


    let mut options = CopyOptions::new();
    options.buffer_size = 1;
    let (tx, rx) = mpsc::channel();
    thread::spawn(move || {
        let handler = |process_info: TransitProcess| {
            tx.send(process_info).unwrap();
            thread::sleep(time::Duration::from_millis(500));
            fs_extra::dir::TransitProcessResult::ContinueOrAbort
        };
        copy_with_progress(&test_folder, &path_to, &options, handler).unwrap();
    });

    loop {
        match rx.try_recv() {
            Ok(process_info) => {
                println!("{} of {} bytes",
                         process_info.copied_bytes,
                         process_info.total_bytes);
            }
            Err(TryRecvError::Disconnected) => {
                println!("finished");
                break;
            }
            Err(TryRecvError::Empty) => {}
        }
    }
    Ok(())

}
fn main() {
    example_copy();
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].