sia_storage library

Dart bindings for the Sia Storage SDK.

Use Sia.builder (or Sia.appKey when reconnecting) as your first call — these auto-initialize the native runtime. Everything downstream is sync or async per its method signature.

final builder = await Sia.builder(
  indexerUrl: 'https://indexer.example.com',
  appMeta: const AppMetadata(...),
);
final sdk = await builder.connected(appKey: existingKey);
final hosts = await sdk.hosts();

Classes

Account
An account registered on the indexer.
App
Application info.
AppKey
AppMetadata
Metadata about an application connecting to the indexer.
Builder
Download
Handle for an in-flight download. Subscribe to progress before reading from data to avoid missing early events.
DownloadOptions
Download configuration. const-constructible.
Host
Information about a storage provider on the Sia network.
NetAddress
A network address of a storage provider on the Sia network.
ObjectEvent
ObjectsCursor
A cursor for paginating through objects.
PackedUpload
PackedUploadSession
Handle for an in-flight packed upload. Subscribe to progress before adding objects to avoid missing early events. Add objects to upload via PackedUploadStreams.add, then await PackedUpload.finalize to obtain the pinned objects.
PinnedObject
PinnedSector
A sector stored on a specific host.
PinnedSlab
A pinned slab from the indexer.
Sdk
SealedObject
A sealed object for offline storage.
ShardProgress
Progress information about a successfully uploaded or downloaded shard.
Sia
Top-level entry points that auto-initialize the native runtime.
Slab
A slab representing a contiguous erasure-coded segment of a file.
Upload
Handle for an in-flight upload. Subscribe to progress before awaiting result to avoid missing early events.
UploadOptions
Upload configuration. const-constructible.

Enums

AddressProtocol
The protocol used in a network address.

Extensions

PackedUploadStreams on PackedUpload
Stream-friendly helper for adding objects to a PackedUpload.
SdkStreams on Sdk
Stream-friendly upload and download helpers.

Functions

encodedSize({required BigInt size, required int dataShards, required int parityShards}) BigInt
Calculates the encoded size of data given the original size and erasure coding parameters.