BlossomRepositoryImpl class

Implemented types

Constructors

BlossomRepositoryImpl({required HttpRequestDS client, required FileIO fileIO})

Properties

client HttpRequestDS
final
fileIO FileIO
final
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
override
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
override
deleteBlob({required String sha256, required List<String> serverUrls, required Nip01Event authorization}) Future<List<BlobDeleteResult>>
Attempts to delete blob from all servers
override
directDownload({required Uri url}) Future<BlobResponse>
Directly downloads a blob from the url, without blossom
override
directDownloadToFile({required Uri url, required String outputPath}) Future<void>
Directly downloads a blob from the url to a file, without blossom
override
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
override
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
override
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
override
listBlobs({required String pubkey, required List<String> serverUrls, DateTime? since, DateTime? until, Nip01Event? authorization}) Future<List<BlobDescriptor>>
Lists blobs from the first successful server
override
mirrorToServer({required String fileUrl, required String serverUrl, required String sha256, required Nip01Event authorization}) Future<BlobUploadResult>
Mirror a file from one server to another, based on the file URL
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
report({required String serverUrl, required String sha256, required Nip01Event reportEvent}) Future<int>
Reports a blob to the server
sha256 is the hash of the blob
reportEvent is the report event
override
supportsRangeRequests({required String sha256, required String serverUrl}) Future<Tuple<bool, int?>>
first value is whether the server supports range requests
second value is the content length of the blob in bytes
override
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
override
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
override

Operators

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