@lokr/cli
v0.2.4
Published
Create lokr shares from the terminal.
Downloads
74
Readme
@lokr/cli
Create lokr shares from the terminal.
Install
No install needed. Run via npx:
npx @lokr/cli share .envOr install globally:
npm install -g @lokr/cli
lokr share .envUsage
The positional argument is treated as a file path when it looks like one (starts with ., /, ~, contains a slash, or matches name.ext). Otherwise it is shared as literal text.
npx @lokr/cli share .env # shares the .env file
npx @lokr/cli share test # shares the string "test"
npx @lokr/cli share ./schema.sql # detected as SQL snippet
npx @lokr/cli share --text "temp-password-42" --expires 1h
echo "$API_KEY" | npx @lokr/cli share --stdin --sensitivity highText files smaller than 256 KiB are inlined as a code or markdown block with a detected language (.env, .json, .sh, .yml, .py, .ts, .md, and so on). Larger or binary files are uploaded as file attachments. Pass --language to override detection.
npx @lokr/cli share ./secret.env --sensitivity critical --burn --creator-email [email protected]
cat schema.sql | npx @lokr/cli share --stdin --language sql --title "Schema dump"Emailing the link directly
Pass --to (or the longer alias --recipient) to email the share link straight from the CLI. This mirrors the "Forward" action in the web UI: each recipient gets a pre-authorised link valid until the share expires.
npx @lokr/cli share .env --to [email protected] --message "Rotate these today."
npx @lokr/cli share ./report.pdf --to [email protected],[email protected] --creator-email [email protected]Combine with --require-email to also restrict viewing to that allowlist. Recipients still receive a one-click link (so they do not need to type the 6 digit code).
npx @lokr/cli share ./secrets.tar --to [email protected] --require-email --creator-email [email protected]Flags
| Flag | Description |
| --- | --- |
| --text <content> | Share a literal string instead of a file. |
| --stdin | Read content from stdin. |
| --title <title> | Title for the share block. |
| --language <lang> | Language hint (makes a text share a code block). |
| --sensitivity <level> | low, medium (default), high, critical. |
| --burn | Burn on read. |
| --expires <when> | 1h, 24h (default), 7d, 30d, <n>h, <n>d, or an ISO datetime. |
| --password [value] | Password protect. Prompts if no value is given. |
| --max-views <n> | Maximum views. Requires --burn. |
| --creator-email <email> | Your email for burn and verification notifications (optional). |
| --require-email | Recipients must verify their email before viewing. Needs --recipient/--to. |
| --recipient <email...>, --to <email...> | Email the share link to this address. Repeatable, or pass multiple as a comma-separated list. Each variant accepts --to [email protected] or [email protected]. |
| --message <text> | Personal note included in the forward email (max 500 characters). |
| --json | Print result as JSON to stdout. |
Output
By default the share URL is printed to stdout. Progress and spinners go to stderr, so piping works:
URL=$(npx @lokr/cli share ./file.zip)
echo "Share: $URL"With --json, stdout is a single JSON object with id, url, and managementToken. Store the management token if you want to revoke the share later.
Self hosted instances
Point the CLI at your own lokr instance:
LOKR_BASE_URL=https://lokr.example.com npx @lokr/cli share .envOr write it to ~/.config/lokr/config.json:
{ "baseUrl": "https://lokr.example.com" }The env var takes precedence over the config file.
Rate limits
Traffic identifying itself as lokr-cli/* uses a dedicated rate limit bucket on the server, separate from the browser UI. If you hit a 429 while sharing from CI, either reduce frequency or self host.
Requirements
Node.js 20 or later.
