Downloading Your Cached Files
The Cached items list shows you what nsin has stored. Sometimes you want the files themselves — to recover images after a server crash, to inspect what visitors are actually being served, or to keep a snapshot before a big change.
nsin-dump-cache.sh does that from your terminal. Give it one or more domains
and it writes every cached object into a folder per domain, keeping the original
paths and filenames.
Download the script
Section titled “Download the script”curl -o nsin-dump-cache.sh https://nsin.ir/docs/nsin-dump-cache.shchmod +x nsin-dump-cache.shIt needs only python3, which macOS and every mainstream Linux already ship.
Nothing to install, no packages.
Set your API key
Section titled “Set your API key”Create a key at panel.nsin.ir → Settings → API Keys and export it:
export NSIN_API_KEY="nsin_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"A read-only key is enough — the script only reads. See API keys for more.
Run it
Section titled “Run it”# One domain (at least one is required)./nsin-dump-cache.sh example.com
# Several at once — each gets its own folder./nsin-dump-cache.sh example.com shop.example.com example.ir
# Images only, into a chosen folder, 12 at a time./nsin-dump-cache.sh example.com --images --out ~/backup -j 12While it runs you get a live progress bar per domain — how many objects are done, how much has been downloaded, the current speed and an ETA — with each finished file listed above it.
▶ example.com registry: 1284 cached entries 1190 unique URLs, 1190 objects to fetch ✓ example.com/assets/hero.webp 184.2 KB · hit ✓ example.com/assets/app.4f2c.js 92.7 KB · hit ████████████████▍ example.com 58% 690/1190 ↓684 ✗6 214.6 MB · 5.1 MB/s ETA 01:24Where the files go
Section titled “Where the files go”Files land under the current folder (or --out), one folder per domain:
example.com/├── index.html├── assets/│ ├── hero.webp│ └── app.4f2c.js└── cdn.example.com/ ← other hostnames get their own subfolder └── logo.png- Subdomains and wildcard hostnames are kept in their own subfolder, so two
different
/logo.pngnever overwrite each other. - Addresses with no file extension are named from what the server actually
returns —
/media/8412served as a WebP is saved as8412.webp. - When the same address is cached with different query strings
(
/search?q=aand/search?q=b), each gets a short suffix so both are kept:search~e244bbd4.html,search~a96c6999.html.
Options
Section titled “Options”| Flag | Environment variable | What it does |
|---|---|---|
--images, -i | IMAGES=1 | Only images. The default takes everything cached. |
--out DIR, -o | OUTDIR | Where to write. Defaults to the current folder. |
-j N | CONCURRENCY | How many downloads at once. Default 8. |
-k | INSECURE=1 | Skip HTTPS certificate checks. |
-h | — | Show help. |
| — | NSIN_API_KEY | Required. Your API key. |
| — | NSIN_API | API base URL. Defaults to https://api.nsin.ir. |
How it works
Section titled “How it works”The script does two things:
- Asks the API which objects are cached for your domain — the same list the panel’s Cached items table shows, paged through in full.
- Downloads each of those addresses over HTTPS and writes it to disk.
That second step is a normal request to your site, so anything still cached is
served straight from the nearest nsin location. Each finished line shows hit
when it came from the cache, and the summary counts them:
done example.com 1184 saved · 0 skipped · 6 failed · 412.9 MB · 1173 edge hitsCommon questions
Section titled “Common questions”It says “not found, or this key’s user has no access”. The domain name must be spelled exactly as it appears in your panel, and the key must belong to an account that owns — or has been shared — that domain.
Some files failed with HTTP 404. Those entries were still listed in the cache but the address no longer exists on your server. Purged or expired items behave the same way.
Can I use it to migrate a site? It gets you the cached, public files — useful, but it is not a backup of your server. Anything never requested through nsin was never cached and won’t appear.