BlossomRepository class abstract

Implementers

Constructors

BlossomRepository()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

checkBlob({required String sha256, required List<String> serverUrls, Nip01Event? authorization}) Future<String>
Checks if the blob exists on the server If authorization is null, the server must be public
computeFileHash(String filePath) Stream<FileHashProgress>
Computes SHA256 hash of a file by reading it in chunks Returns stream updates with progress and a final event containing FileHashProgress.hash
deleteBlob({required String sha256, required List<String> serverUrls, required Nip01Event authorization}) Future<List<BlobDeleteResult>>
Attempts to delete blob from all servers
directDownload({required Uri url}) Future<BlobResponse>
Directly downloads a blob from the url, without blossom
directDownloadToFile({required Uri url, required String outputPath}) Future<void>
Directly downloads a blob from the url to a file, without blossom
downloadBlobToFile({required String sha256, required String outputPath, required List<String> serverUrls, Nip01Event? authorization}) Future<void>
Downloads a blob directly to a file path For web: triggers browser download dialog with the file For native: saves to the file system at the given path
getBlob({required String sha256, required List<String> serverUrls, Nip01Event? authorization, int? start, int? end}) Future<BlobResponse>
Gets a blob by trying servers sequentially until success If authorization is null, the server must be public If start and end are null, the entire blob is returned start and end are used to download a range of bytes, @see MDN HTTP range requests
getBlobStream({required String sha256, required List<String> serverUrls, Nip01Event? authorization, int chunkSize = 1024 * 1024}) Future<Stream<BlobResponse>>
checks if the server supports range requests, if no server supports range requests, the entire blob is returned otherwise, the blob is returned in chunks. @see MDN HTTP range requests
listBlobs({required String pubkey, required List<String> serverUrls, DateTime? since, DateTime? until, Nip01Event? authorization}) Future<List<BlobDescriptor>>
Lists blobs from the first successful server
mirrorToServer({required String fileUrl, required String serverUrl, required String sha256, required Nip01Event authorization}) Future<BlobUploadResult>
Mirrors a blob from one server to another using the /mirror endpoint fileUrl is the source URL where the blob exists serverUrl is the target server to mirror to sha256 is the hash of the blob authorization is the signed authorization event
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
report({required String sha256, required Nip01Event reportEvent, required String serverUrl}) Future<int>
Reports a blob to the server
sha256 is the hash of the blob
reportEvent is the report event
supportsRangeRequests({required String sha256, required String serverUrl}) Future<Tuple<bool, int?>>
Checks if the server supports range requests and gets the content length
first value is whether the server supports range requests
second value is the content length of the blob in bytes
toString() String
A string representation of this object.
inherited
uploadBlob({required Stream<List<int>> dataStreamFactory(), required int contentLength, required Nip01Event authorization, String? contentType, required List<String> serverUrls, UploadStrategy strategy = UploadStrategy.mirrorAfterSuccess, bool mediaOptimisation = false}) Stream<BlobUploadProgress>
Uploads a blob using the specified strategy Returns a stream of progress updates
uploadBlobFromFile({required String filePath, required Nip01Event authorization, String? contentType, required List<String> serverUrls, UploadStrategy strategy = UploadStrategy.mirrorAfterSuccess, bool mediaOptimisation = false}) Stream<BlobUploadProgress>
Uploads a blob from a file path using the specified strategy Reads the file in chunks to minimize memory usage For web: prompts user to select a file via File System Access API For native: filePath is the actual file system path Returns a stream of progress updates

Operators

operator ==(Object other) bool
The equality operator.
inherited