filego/
lib.rs

1//! # FileGo
2//!
3//! A file splitting & merging solution.
4//!
5//! ## Quick Start
6//!
7//! Split file from a path to a directory with `Split` struct.
8//!
9//! ```no_run
10//! use std::path::PathBuf;
11//!
12//! use filego::split::{Split, SplitResult};
13//!
14//! let result: SplitResult = Split::new()
15//!     .in_file(PathBuf::from("path").join("to").join("file"))
16//!     .out_dir(PathBuf::from("path").join("to").join("dir"))
17//!     .run()
18//!     .unwrap();
19//! ```
20//!
21//! Async version also available with the `async-std` and `tokio` features:
22//!
23//! ```no_run
24//! // This is a `async-std` example
25//!
26//! use async_std::path::PathBuf;
27//!
28//! use filego::split::{
29//!     Split,
30//!     SplitResult,
31//!     async_std::SplitAsyncExt as _,
32//! };
33//!
34//! # async fn example() {
35//! let result: SplitResult = Split::new()
36//!     .in_file(PathBuf::from("path").join("to").join("file"))
37//!     .out_dir(PathBuf::from("path").join("to").join("dir"))
38//!     .run_async()
39//!     .await
40//!     .unwrap();
41//! # }
42//! ```
43//!
44//! ```no_run
45//! // This is a `tokio` example
46//!
47//! use std::path::PathBuf;
48//!
49//! use filego::split::{
50//!     Split,
51//!     SplitResult,
52//!     tokio::SplitAsyncExt as _,
53//! };
54//!
55//! # async fn example() {
56//! let result: SplitResult = Split::new()
57//!     .in_file(PathBuf::from("path").join("to").join("file"))
58//!     .out_dir(PathBuf::from("path").join("to").join("dir"))
59//!     .run_async()
60//!     .await
61//!     .unwrap();
62//! # }
63//! ```
64
65/// Split module.
66pub mod split;
67
68/// Check module.
69pub mod check;
70
71/// Merge module.
72pub mod merge;
73
74/// Functions implemented with `async-std`.
75#[cfg(feature = "async-std")]
76pub(crate) mod async_std;
77
78/// Functions implemented with `tokio`.
79#[cfg(feature = "tokio")]
80pub(crate) mod tokio;
81
82/// The default chunk size in bytes.
83pub const CHUNK_SIZE_DEFAULT: usize = 2 * 1024 * 1024;
84
85/// The default maximum size of the buffer capacity in bytes.
86pub const BUFFER_CAPACITY_MAX_DEFAULT: usize = 10 * 1024 * 1024;