Blossom class
direct access usecase to blossom
use files usecase for a more convinent way to manage files
Constructors
- Blossom({required BlossomUserServerList blossomUserServerList, required BlossomRepository blossomRepository, required Accounts accounts})
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, bool useAuth = false, List< String> ? serverUrls, String? pubkeyToFetchUserServerList, EventSigner? customSigner}) → Future<String> -
checks if the blob exists on the server without downloading, useful to check before streaming a video via url
ifserverUrlsis null, the userServerList is fetched from nostr.
if the pukey has no UserServerList (kind: 10063), throws an error -
deleteBlob(
{required String sha256, List< String> ? serverUrls, EventSigner? customSigner}) → Future<List< BlobDeleteResult> > -
delete a blob
if
serverUrlsis null, the userServerList is fetched from nostr.
if the pukey has no UserServerList (kind: 10063), throws an error
the current signer is used to sign the request, orcustomSignerif provided
if no signer is available, a temporary signer is created -
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, bool useAuth = false, List< String> ? serverUrls, String? pubkeyToFetchUserServerList, EventSigner? customSigner}) → Future<void> - Downloads a blob directly to a file path (without loading into memory) For native platforms (Windows, macOS, Linux, Android, iOS): uses actual file system paths For web: triggers browser download dialog to save the file
-
getBlob(
{required String sha256, bool useAuth = false, List< String> ? serverUrls, String? pubkeyToFetchUserServerList, EventSigner? customSigner}) → Future<BlobResponse> -
Gets a blob by trying servers sequentially until success (fallback)
ifserverUrlsis null, the userServerList is fetched from nostr.
if the pukey has no UserServerList (kind: 10063), throws an error -
getBlobStream(
{required String sha256, bool useAuth = false, List< String> ? serverUrls, String? pubkeyToFetchUserServerList, int chunkSize = 1024 * 1024, EventSigner? customSigner}) → Future<Stream< BlobResponse> > -
downloads a blob as a stream, useful for large files like videos
ifserverUrlsis null, the userServerList is fetched from nostr.
if the pukey has no UserServerList (kind: 10063), throws an error -
listBlobs(
{required String pubkey, List< String> ? serverUrls, bool useAuth = true, DateTime? since, DateTime? until, EventSigner? customSigner}) → Future<List< BlobDescriptor> > -
list the
pubkeyblobs
ifserverUrlsis null, the userServerList is fetched from nostr.
if the pukey has no UserServerList (kind: 10063), throws an error -
mirrorToServers(
{required Uri blossomUrl, required List< String> targetServerUrls, EventSigner? customSigner}) → Future<List< BlobUploadResult> > - Mirror a blob from a blossom URL to specified servers using the blossom /mirror endpoint
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
report(
{required String sha256, required String eventId, required String reportType, required String reportMsg, required String serverUrl, EventSigner? customSigner}) → Future< int> -
Reports a blob to the server
sha256is the hash of the blobeventIdis the event id where the blob was mentionedreportTypeis the type of report, e.g. malware @see nip56reportMsgis the message to send to the serverserverUrlserver url to report tocustomSigneroptional custom signer to use for signing the report, if not provided uses the current logged in signer or creates a temporary one -
toString(
) → String -
A string representation of this object.
inherited
-
uploadBlob(
{required Uint8List data, List< String> ? serverUrls, String? contentType, UploadStrategy strategy = UploadStrategy.mirrorAfterSuccess, bool serverMediaOptimisation = false, EventSigner? customSigner}) → Future<List< BlobUploadResult> > -
upload a blob to the server
if
serverUrlsis null, the userServerList is fetched from nostr.
if the pukey has no UserServerList (kind: 10063), throws an error
the current signer is used to sign the request, orcustomSignerif provided
if no signer is available, a temporary signer is created
strategyis the upload strategy, default is mirrorAfterSuccess
serverMediaOptimisationis whether the server should optimise the mediaBUD-05, IMPORTANT: the server hash will be different \ -
uploadBlobFromFile(
{required String filePath, List< String> ? serverUrls, String? contentType, UploadStrategy strategy = UploadStrategy.mirrorAfterSuccess, bool serverMediaOptimisation = false, EventSigner? customSigner}) → Stream<BlobUploadProgress> - Upload a blob from a file path For native platforms (Windows, macOS, Linux, Android, iOS): uses actual file system paths For web: prompts user to select a file using File System Access API (modern browsers)
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- sha256Regex → RegExp
-
Regular expression to match SHA256 in URLs
final