Files class
high level usecase to manage files on nostr
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
-
checkUrl(
{required String url, List< String> ? serverUrls, String? pubkey, AuthPolicy? auth}) → Future<String> -
checks if a url is a blossom url.
it its not a blossom url, the url is returned.
if its a blossom url, blossom is used to check if the blob exists on the server(s)
returns alive url if the blob exists, throws an error if the blob does not existauthsays which identity the check may be attributed to, see AuthPolicy. It is ignored for a plain url, which is returned as is. -
delete(
{required String sha256, List< String> ? serverUrls, AuthPolicy? auth}) → Future<List< BlobDeleteResult> > -
deletes a file from the server(s)
ifserverUrlsis null, the userServerList is fetched from nostr.
authsays which identity the deletion may be attributed to, see AuthPolicy. -
download(
{required String url, List< String> ? serverUrls, String? pubkey, AuthPolicy? auth}) → Future<BlobResponse> -
download a file from the server(s)
if its a blossom url (sha256 in url), blossom is used to download
if its a public url, the file is downloaded directly
serverUrlsandpubkeyare used to download from blossom
ifserverUrlsis null, the userServerList is fetched from nostr (using the pubkey).
if bothserverUrlsandpubkeyare null, throws an error.authsays which identity the download may be attributed to, see AuthPolicy. It is ignored for a plain url, which is fetched directly and never speaks blossom. -
downloadToFile(
{required String url, required String outputPath, AuthPolicy? auth, List< String> ? serverUrls, String? pubkey}) → Future<void> - Downloads a file directly to disk path (without loading whole file 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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
upload(
{required NdkFile file, List< String> ? serverUrls, bool serverMediaOptimisation = false, AuthPolicy? auth}) → Future<List< BlobUploadResult> > -
upload a file to the server(s)
ifserverUrlsis null, the userServerList is fetched from nostr.
if no serverUrls (param or nostr) are found, throws an errorserverMediaOptimisationis whether the server should optimise the mediaBUD-05, IMPORTANT: the server hash will be different
authsays which identity the upload may be attributed to, see AuthPolicy. -
uploadFromFile(
{required String filePath, List< String> ? serverUrls, String? contentType, UploadStrategy strategy = UploadStrategy.mirrorAfterSuccess, bool serverMediaOptimisation = false, AuthPolicy? auth}) → Stream<BlobUploadProgress> - Upload a file from disk 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