Files

high level

CLI — ndk files upload|download|delete|check

Example

blossom
final downloadResult = await ndk.files.download(
  url:
      "https://cdn.hzrd149.com/b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553.pdf",
);

print(
non blossom url
final ndk = Ndk.defaultConfig();

final downloadResult = await ndk.files.download(
  url: "https://camelus.app/.well-known/nostr.json",
);

How to use

Files uses blossom under the hood to get, upload and delete files.
The default user server list, specified by kind 10063 is used for upload and delete

If you need more granular control check out:

Blossom
../blossom/

Server authentication

Every method takes an auth parameter saying which identity a blossom server may learn, described in blossom. It is ignored for a plain url, which is fetched directly.

await ndk.files.upload(
  file: myFile,
  auth: AuthPolicy.require(account),
);