CLI and TypeScript library for uploading files to mirri.link.
# As a CLI
npm install -g mirri-link
# As a library
npm install mirri-linkThe CLI is exposed as mirri. It prints the resulting public URL to stdout.
mirri ./report.pdf
# → https://mirri.link/abc123echo "hello world" | mirri
# Uses default filename "file.txt" and content-type "text/plain"
echo "# Hello" | mirri --filename hello.md
# Markdown is rendered to a styled HTML page
cat data.json | mirri -f data.json -t application/json| Flag | Default | Description |
|---|---|---|
-f, --filename <name> |
basename of path, or file.txt for stdin |
Filename to upload as |
-t, --content-type <t> |
guessed from filename, or text/plain for stdin |
MIME type |
-e, --expiry <dur> |
(no expiry) | Expire after duration (e.g. 30s, 5m, 2h, 2d, 1w, 1y) |
-h, --help |
Show help |
mirri ./screenshot.png --expiry 2d
cat data.json | mirri -f data.json -t application/json -e 1hAny upload whose content-type is text/markdown (including any .md or
.markdown file) is routed through mirri.link's markdown API, which renders
the content to a styled HTML page rather than serving the raw source.
Expiry is not supported for markdown uploads.
import { uploadFile, upload, uploadMarkdown, parseDuration } from 'mirri-link'
// Upload a file from disk
const { publicUrl } = await uploadFile('./image.png')
// Upload a file that expires in 2 days
await uploadFile('./report.pdf', { expiry: parseDuration('2d') })
// Upload a buffer or string with explicit metadata
const result = await upload(Buffer.from('hello'), {
filename: 'greeting.txt',
contentType: 'text/plain',
})
// Upload markdown content directly (returns a rendered HTML page)
const md = await uploadMarkdown('# Hello\n\nThis is a test.')Reads a file from disk and uploads it. The filename and content-type are
inferred from the path unless overridden. Accepts optional expiry (seconds).
Uploads a Buffer, Uint8Array, ArrayBuffer, or string with explicit
filename and contentType. Accepts optional expiry (seconds).
Automatically routes through the markdown API when contentType is
text/markdown.
Parses a duration string like "30s", "5m", "2h", "2d", "1w" (or a
bare number of seconds) into a number of seconds. Useful for converting
human-friendly input into the expiry option.
Posts markdown content to mirri.link's markdown API and returns a URL to a rendered HTML page.
All upload functions return Promise<{ publicUrl: string }>.
npm install
npm run build # bundle with tsup
npm run dev # rebuild on change
npm run typecheck # tsc --noEmit
npm run format # prettierReleases are automated via semantic-release.
Pushes to main are analyzed for Conventional Commits
and published to npm with a corresponding GitHub Release.
MIT