Expand description
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.
Structs§
- Chunk
Stream - Active
/chunks/streamupload session. Open one viaFileApi::chunks_stream. - Collection
Entry - One entry of an in-memory collection: a tar path plus its raw bytes.
Mirrors bee-go’s
CollectionEntryand bee-js’sCollectionitems. - Feed
Reader - Reader bound to a
(owner, topic)pair. Wraps the lower-levelFileApifeed methods for callers that prefer the bee-jsFeedReadershape. - Feed
Update - Result of a feed lookup: the wrapped chunk payload plus the
indexes parsed from
swarm-feed-index/swarm-feed-index-next. - Feed
Writer - Writer bound to a
(signer, topic)pair. Owner is derived from the signer. - FileApi
- Handle exposing the file/data/chunk endpoints. Cheap to clone
(holds an
Arc<Inner>). - Reference
Information - Result of
FileApi::probe_data: the size of the data behind a/bytesreference, learned viaHEADwithout downloading the body. - SocReader
- Reader for SOCs owned by a known
EthAddress. Fetches each chunk by computing itskeccak256(identifier || owner)address and verifying the recovered signer matches the owner. - SocWriter
- Reader + writer for SOCs signed by a known
PrivateKey. - Stream
Progress - Per-chunk upload signal emitted by
FileApi::stream_directory. Mirrors bee-jsUploadProgress.
Functions§
- collection_
size - Cumulative byte size of the entries’ data — equivalent to bee-js
getCollectionSize. - feed_
update_ chunk_ reference - Compute the SOC chunk address for a feed update at
(owner, topic, index)—keccak256(identifier || owner). Use this withFileApi::download_chunkto verify retrievability of past updates. - hash_
collection_ entries - Offline content-address every entry in a collection and assemble
them into a Mantaray manifest. Returns the manifest’s root chunk
address — the same value Bee would emit on
upload_collection_entries. No I/O. - hash_
directory - Same as
hash_collection_entriesbut reads entries off disk from the directory tree atdir. Mirrors bee-jshashDirectory. - make_
feed_ identifier - Compute the feed identifier for a
(topic, index)pair —keccak256(topic || BE-uint64(index)). - read_
directory_ entries - Walk
dirrecursively, collecting every regular file as aCollectionEntrywith its filesystem-relative path. Mirrors bee-go’s filepath.Walk inUploadCollection. - soc_
address - Reference to a SOC chunk:
keccak256(identifier || owner). Re-exported convenience wrapper over the swarm-level helper.
Type Aliases§
- OnStream
Progress Fn - Boxed callback for
StreamProgressevents.