8000 GitHub - djinoz/blossom_uploader: upload images and other blobs to nostr's blossom servers
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

djinoz/blossom_uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blossom Uploader for Nostr

A Node.js command-line tool to upload images and media files to various services compatible with Nostr notes, with full support for the Blossom protocol.

Installation

npm install

Usage

node blossom_uploader.js [options] <files...>

Options

  • -s, --service <service>: Upload service to use (default: "imgbb")
  • -k, --key <key>: API key for the service (if required)
  • -u, --url <url>: Custom URL for the service (required for blossom)
  • -n, --nsec <nsec>: Nostr private key (nsec) for blossom authentication
  • -d, --debug: Show debug information
  • -o, --output <format>: Output format: json or url (default: "url")
  • -h, --help: Display help
  • -V, --version: Output the version number

Examples

Upload a single image using ImgBB (default):

node blossom_uploader.js path/to/image.jpg

Upload using Imgur:

node blossom_uploader.js -s imgur image1.png

Use your own ImgBB API key:

node blossom_uploader.js -s imgbb -k YOUR_API_KEY image.png

Upload to a Blossom server using your nsec private key:

node blossom_uploader.js -s blossom -u https://blossom.band/upload -n nsec1... image.png

Get JSON output:

node blossom_uploader.js -o json image.jpg

Debug mode to see detailed request/response information:

node blossom_uploader.js -d image.jpg

Supported Services

Standard Image Hosting

  • imgbb (default) - Uses a public demo API key for testing
  • freeimage.host - Uses a public demo API key
  • imgur - Uses anonymous uploads via client ID

Nostr-specific Blossom Servers

The tool fully supports the BUDS02 specification for Blossom servers, including:

  • blossom - Generic service type for any Blossom-compatible server
    • Requires a URL (via -u) and optionally an nsec key
    • Automatically generates a temporary key if no nsec provided
    • Implements NIP-98 HTTP authentication with proper event signing
    • Requires URL in format: https://example.com/upload

Example Blossom servers:

  • blossom.band
  • blossom.nostr.wine (paid)
  • nostr.build (requires API key)

Supported File Types

The tool supports the following file types and automatically sets the correct MIME type:

Extension MIME Type Description
.jpg/.jpeg image/jpeg JPEG images
.png image/png PNG images
.gif image/gif GIF images
.webp image/webp WebP images
.svg image/svg+xml SVG images
.pdf application/pdf PDF documents
.mp4 video/mp4 MP4 videos
.mov video/quicktime QuickTime videos
.mp3 audio/mpeg MP3 audio files

Other file types are uploaded with the generic application/octet-stream content type.

Notes on Nostr Image Hosting

Many Nostr-specific image hosting services have different requirements:

  1. Standard Services (imgbb, imgur) - These provide simple API endpoints and are widely compatible
  2. Blossom Protocol Services - These implement the BUDS02 specification and require Nostr authentication

For Blossom servers, the tool:

  • Generates a SHA-256 hash of the file
  • Creates and signs a proper Nostr event (kind 24242)
  • Includes required tags: ['t', 'upload'], ['x', hash], ['expiration', timestamp]
  • Sets the correct Content-Type header based on file extension
  • Securely encodes the authorization header in the required format

About

upload images and other blobs to nostr's blossom servers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0