Skip to content

jtsternberg/drplr

Repository files navigation

drplr

A command-line interface for uploading files to Droplr using their official SDK.

npm version MIT licensed npm downloads

Installation

npm install -g drplr

then use it like this:

drplr auth login your_username your_password
drplr file.png

Or try it without installing:

npx drplr auth login your_username your_password
npx drplr file.png

Authentication Setup

Choose one of these authentication methods:

Method 1: Username/Password (Easiest)

drplr auth login your_username your_password

Method 2: JWT Token (More Secure)

  1. Log into d.pr in your browser
  2. Open Chrome DevTools > Application > Cookies > d.pr
  3. Copy the JWT token value
  4. Configure the CLI:
    drplr auth token eyJhbGciOiJIUzI1NiIs...

Note: JWT tokens may expire and may need to be refreshed periodically.

Method 3: 1Password CLI (Recommended)

Requires the 1Password CLI:

# Auto-detect Droplr item in 1Password
drplr auth 1password

# Or specify item by name
drplr auth 1password "My Droplr Login"

Credentials are fetched from 1Password at runtime — nothing is stored on disk.

Usage

File Uploads

# Upload a file
drplr file.png

# Upload a private file
drplr file.png --private

# Upload with password protection
drplr file.png --private --password mypassword

# Upload with custom title
drplr document.pdf --title "Important Document"

Link Shortening

# Create a short link
drplr link https://example.com/very/long/url

# Create a private link with title
drplr link https://example.com --private --title "My Link"

# Create a password-protected link
drplr link https://example.com --private --password secret123

Note Creation

# Create a text note
drplr note "This is my quick note"

# Create a note from a file
drplr note --file notes.txt

# Create a private note with custom title
drplr note "Secret information" --private --title "Confidential"

# Create a code snippet
drplr note --code 'console.log("Hello, World!")' --lang javascript

# Create code snippet with title
drplr note --code 'def hello(): print("Hi!")' --lang python --title "Python Hello"

Global Options

# Minimal output (just the URL)
drplr file.png --porcelain

# Debug mode with full API responses
drplr file.png --debug

# Combine global and command-specific options
drplr note "Debug this" --debug --private

Shell Completions

# Auto-install for your shell (zsh, bash, or fish)
drplr completions --install

# Or manually load (add to your shell rc file)
eval "$(drplr completions zsh)"    # zsh
eval "$(drplr completions bash)"   # bash
drplr completions fish | source    # fish

Help and Information

# Show comprehensive help
drplr help

# Get help for specific commands (shows in usage examples)
drplr link
drplr note

Features

Core Drop Types

  • ✅ File uploads to Droplr using official SDK
  • ✅ Link shortening (URL drops) with title support
  • ✅ Note creation (text, file-based, and code snippets)
  • ✅ Code syntax highlighting for 25+ programming languages
  • ✅ Custom titles for all drop types

Privacy & Security

  • ✅ Public and private uploads/links/notes
  • ✅ Password protection for all drop types
  • ✅ JWT token authentication from browser
  • ✅ Username/password authentication
  • ✅ 1Password CLI integration (credentials fetched at runtime, never stored)
  • ✅ Encrypted credential storage with machine-specific keys

User Experience

  • ✅ Comprehensive help system with examples
  • ✅ Global flags (--porcelain for minimal output, --debug for diagnostics)
  • ✅ Detailed error messages with field-specific validation
  • ✅ Multiple file format support with automatic MIME type detection
  • ✅ Shell completions for zsh, bash, and fish (auto-install or eval)
  • ✅ Backward compatibility (config command still works as alias for auth)

Developer Experience

  • ✅ Comprehensive test suite (49 passing tests)
  • ✅ Modular architecture with clean separation of concerns
  • ✅ Complete documentation (README, TESTING, ROADMAP)
  • ✅ Multiple test script variants for different scenarios

Requirements

  • Node.js 14.0.0 or higher
  • Valid Droplr account

Testing

This project includes a comprehensive test suite with Jest:

# Run all working tests (49 tests)
npm test

# Run only unit tests
npm run test:unit

# Run only integration tests
npm run test:integration

# Run tests in watch mode
npm run test:watch

# Generate coverage report
npm run test:coverage

See TESTING.md for detailed information about the test architecture.

Documentation

Alternative Installation Methods

Other package managers

# Yarn
yarn global add drplr

# pnpm
pnpm install -g drplr

Manual install from GitHub

# Clone and set up
git clone https://github.com/jtsternberg/drplr.git
cd drplr
npm install

# Option 1: Create an alias
echo 'alias drplr="node /path/to/drplr/drplr.js"' >> ~/.bashrc
source ~/.bashrc

# Option 2: Add to PATH
export PATH="$PATH:/path/to/drplr"

Development Installation

  1. Clone this repository
  2. Install dependencies: npm install
  3. Link globally: npm link

Or install directly from a cloned local directory:

git clone https://github.com/jtsternberg/drplr.git
npm install -g /path/to/drplr

Changes to the local files take effect immediately without reinstalling.

About

A command-line interface for uploading files to Droplr using their official SDK

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors