Blossom Uploader ​
Blossom is a new protocol that challenges IPFS with the simplicity of Nostr.
Files are uploaded to multiple servers and identified by their SHA-256 hash. If a server goes offline, clients may be able to locate the file on other servers.
Usage ​
The BlossomUploader can be used to upload files to multiple Blossom servers at once.
ts
import { BlossomUploader } from '@nostrify/nostrify/uploaders';
const uploader = new BlossomUploader({
servers: ['https://blossom.primal.net/' /*, https://cdn.satellite.earth */],
signer: window.nostr,
});
const tags = await uploader.upload(file);Options ​
serversarray of URLs to Blossom servers.signerNostr signer instance to sign the upload request.fetch(optional) custom fetch implementation.expiresIn(optional) number of milliseconds each upload request should expire in. (Default:60_000)
Results ​
Results are returned as a tags array (string[][]) of NIP-94 tags. The first tag is guaranteed to be a url.
ts
[
['url', 'https://blossom.primal.net/7508bd9d8b0ed6e0891a3b973adf6011b1e49f6174910d6a1eb722a4a2e30539.png'],
['x', '7508bd9d8b0ed6e0891a3b973adf6011b1e49f6174910d6a1eb722a4a2e30539'],
['ox', '7508bd9d8b0ed6e0891a3b973adf6011b1e49f6174910d6a1eb722a4a2e30539'],
['size', '172'],
['m', 'image/png'],
];urlpublic URL of the file.xSHA-256 hex-encoded string of the file.oxSHA-256 hex-encoded string of the original file, before any transformations done by the upload server.sizesize of file in bytes.mstring indicating the data type of the file. The MIME types format must be used, and they should be lowercase.