1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! File / data / chunk / SOC / feed / collection uploads and
//! downloads. Mirrors `pkg/file` in bee-go.
//!
//! Get a [`FileApi`] from [`crate::Client::file`].
//!
//! # Streaming vs. buffered transfers
//!
//! [`FileApi::download_data`] / [`FileApi::download_file`] buffer the
//! full body into [`bytes::Bytes`] before returning — fine for ≤ a few
//! hundred MB but will OOM on multi-GB references. For larger
//! downloads, use [`FileApi::download_data_response`] (or
//! `download_file_response`) which returns the raw [`reqwest::Response`]
//! so you can drive [`reqwest::Response::bytes_stream`] yourself.
//!
//! Uploads accept `impl Into<Bytes>` and stream the body to Bee. The
//! chunk-by-chunk variants ([`FileApi::stream_directory`] and
//! [`FileApi::stream_collection_entries`]) bound peak memory at the
//! BMT chunk size regardless of file size and report progress via a
//! caller-supplied [`OnStreamProgressFn`].
//!
//! # Cancellation
//!
//! Dropping the future returned by any upload / download cancels the
//! in-flight HTTP request. For [`FileApi::stream_directory`] and
//! [`FileApi::stream_collection_entries`], chunks already accepted by
//! the local Bee node remain in the local reserve but the manifest is
//! not finalized — the resulting orphan chunks are eventually pruned
//! but cost reserve space until then.
pub use ;
pub use ChunkStream;
pub use ReferenceInformation;
pub use ;
pub use ;
pub use ;
use Arc;
use crateInner;
/// Handle exposing the file/data/chunk endpoints. Cheap to clone
/// (holds an `Arc<Inner>`).