- Docs
- Caching
Downloading Your Cached Files
Download everything nsin has cached for a domain, straight from cache storage, with the nsin-dump-cache.sh script.
On this page
The Cached items list shows what's stored. nsin-dump-cache.sh downloads the files from your terminal, one folder per domain, keeping paths and filenames.
Files come straight from cache storage, not your site, so a dead origin makes no difference.
Download the script
curl -o nsin-dump-cache.sh https://nsin.ir/docs/nsin-dump-cache.sh
chmod +x nsin-dump-cache.shNeeds only python3 — already on macOS and most Linux.
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. See API keys.
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
# A different edge location, images only, into a chosen folder, 12 at a time
./nsin-dump-cache.sh example.com --node TH --images --out ~/backup -j 12Live progress per domain: objects done, bytes, speed, and ETA.
▶ example.com
registry: 1284 cached entries at node IR
1190 unique URLs, 1190 objects to fetch
✓ example.com/assets/hero.webp 184.2 KB
✓ example.com/assets/app.4f2c.js 92.7 KB
⊙ example.com/old/banner.png no longer cached
████████████████▍ example.com
58% 690/1190 ↓684 ⊙6 214.6 MB · 5.1 MB/s ETA 01:24Choosing an edge location
Your site caches separately per nsin location; --node picks which copy to download:
./nsin-dump-cache.sh example.com # IR, the default
./nsin-dump-cache.sh example.com --node TH
./nsin-dump-cache.sh example.com --node any # whichever copy is listed firstNode names match Cached items, case-sensitive; an empty location lists the ones that aren't:
nothing at node NY. cached at: IR (1284), TH (233)--node any gives the widest coverage, pulling whichever copy exists.
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 wildcards get their own subfolder — no
/logo.pngcollisions. - No-extension files are named by content type —
/media/8412as WebP saves as8412.webp. - Different query strings on one address (
/search?q=a,/search?q=b) get a suffix per copy:search~e244bbd4.html,search~a96c6999.html. - Files come out uncompressed, as stored, even if gzipped for visitors.
Options
| Flag | Environment variable | What it does |
|---|---|---|
--node NAME, -n |
NSIN_NODE |
Which location's copy to take. Default IR; any takes whatever's listed. |
--images, -i |
IMAGES=1 |
Only images; default takes everything. |
--out DIR, -o |
OUTDIR |
Where to write. Default: 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; default https://api.nsin.ir. |
How it works
Two API calls per object, both to api.nsin.ir:
- List —
GET /domains/<domain>/cache/keys, paged and filtered to the node. Same data as the panel's Cached items table. - Download —
GET /domains/<domain>/cache/keys/contentper row, returning that entry's stored bytes.
Each entry is keyed by hostname, node and key_hash. Nothing touches your site: no DNS, no edge request, no server request.
Common questions
It says "not found, or this key's user has no access". Spell the domain exactly as your panel shows it — the key's account must own, or have been shared, that domain.
I get far fewer files than the panel's item count.
The panel's count covers every location; a --node run only takes that location's copies. Try --node any.
Can I use it to migrate a site? You get cached, public files — useful, not a backup. Login-only, uncached, or unvisited pages were never stored.