Integration · no API key

Publish from the command line

Upload a file from the command line and get a link back: one npx command shares a file or folder and prints only the URL, ready for scripts, CI and agents.

Share a file or a whole folder (dist/, build/, out/). Prints the link; run login once to keep links in your account.

npx @anyshare/cli ./dist

How the CLI works

One file is uploaded as it is. A folder is zipped in memory and becomes a website if it has an index.html, or a browsable file list if it doesn’t. Several paths become one link, keeping their paths relative to their common parent folder.

The link is the only thing printed to stdout; progress goes to stderr. That makes it easy to capture: URL=$(npx -y @anyshare/cli ./dist -q). It needs Node.js 20 or newer and nothing else. Run it with npx, or npm install -g @anyshare/cli to get the anyshare command.

Reference

Commands

Everything the CLI does, in six snippets.

Share

One file, a folder, or several paths under one link.

npx @anyshare/cli report.html
npx @anyshare/cli ./dist --slug q3-report --title "Q3 report"
npx @anyshare/cli screenshot.png notes.md

Scripts

-q prints only the URL; status lines go to stderr.

URL=$(npx -y @anyshare/cli ./dist -q)
echo "Preview: $URL"

JSON

The full response, including the update token and expiresAt.

npx -y @anyshare/cli ./dist --json

Update & delete

After npm install -g @anyshare/cli. Tokens come from ~/.config/anyshare/sites.json.

anyshare update sunny-otter-4821 ./dist
anyshare delete sunny-otter-4821
anyshare list
anyshare open sunny-otter-4821
anyshare claim sunny-otter-4821

Single-page app

Serve index.html for unknown paths. Usually detected automatically.

npx @anyshare/cli ./dist --spa

MCP

Starts the local MCP server on stdio for Claude Code, Codex, Cursor and other agents.

npx -y @anyshare/cli mcp

When it’s shared

What your link shows

Whatever you point it at gets the right viewer: HTML runs as a site, source files get syntax highlighting with line numbers, Markdown gets a reading page.

  • Folders become websites
  • Code with line numbers
  • Markdown as a reading page
  • Several files under one link

How it works

Three commands you’ll use

  1. Step 1:

    Share

    npx @anyshare/cli ./dist uploads the folder and prints the URL. Add --slug q3-report to choose the address.

  2. Step 2:

    Use the URL

    It’s printed on stdout, with a claim link on stderr: without an account the link lasts 1 hour unless you keep it. --copy puts it on the clipboard and --open opens it in your browser.

  3. Step 3:

    Update later

    anyshare update <slug> ./dist replaces the content and keeps the URL. The token comes from ~/.config/anyshare/sites.json.

The details

Built for scripts and agents

  • Safe folder uploads

    node_modules, .git, caches, OS junk and secrets (.env*, .dev.vars, .npmrc, .netrc, SSH keys, *.pem, .ssh/, .aws/) are never uploaded. Naming a secret file directly is refused.

  • Catches unbuilt source

    A folder with a package.json but no index.html gets a warning that points at the build folder, because anyshare never runs your build.

  • Checks limits first

    Free uploads are limited to 50 MB and 1,000 files, and the CLI checks before sending anything.

  • Retries without duplicates

    Network failures and 429/5xx responses are retried with backoff and the same Idempotency-Key, so a retry never creates a second link. Exit codes: 0 success, 1 API or network error, 2 usage error.

  • Tokens and sign-in handled for you

    Every link’s token is saved in ~/.config/anyshare/sites.json (mode 0600); on another machine, pass --token or set ANYSHARE_TOKEN. anyshare login saves an account API key, so new links go straight into your free account.

  • Points anywhere

    ANYSHARE_API_URL sends uploads to another server, such as a local development instance.

FAQ

Questions, answered.

Do I need to log in or create an API key?
Not to publish. There’s nothing to configure: the first command you run publishes a link, and each link comes with its own token for updates. Without an account a link lasts 1 hour; keep it with a free account and it lasts 30 days from the upload. Run anyshare login once (it opens the browser to approve a code) and new links are saved to your account automatically.
Why isn’t it just `npx anyshare`?
The anyshare name on npm belongs to an unrelated package, so the CLI is published as @anyshare/cli. After a global install, the command it gives you is anyshare.
What gets left out when I share a folder?
Dependencies and caches (node_modules, .git, .next, .turbo, .cache, __pycache__, .venv), OS junk, and anything that looks like a secret. Skipped secrets are listed in a warning.
How do I use it in CI?
Use npx -y so npx doesn’t stop to ask, and -q to capture just the URL. Set ANYSHARE_API_KEY to your account’s key so the links last 30 days instead of 1 hour. The GitHub Actions recipe shows a full workflow that comments the link on a pull request.
What happens if an upload fails halfway?
The CLI retries network errors and 429/5xx responses with backoff, reusing the same Idempotency-Key, so you never end up with two links. If it gives up, it exits with code 1 and prints the API’s message.

Give your agent a URL for any file.

One step to connect, no account or API key. It hands you back a link anyone can open, and a claim link to keep it.