--storage
- CLI
- --storage
- REST
- with_storage
Seeds the browser from a storage file before the page is requested, and rewrites the file with the storage the render ends with. The file uses Playwright’s storageState format.
- A path that does not exist starts the render with empty storage.
ro:PATHseeds from PATH and leaves it unchanged.- The file is rewritten when the render fails or times out, too.
- A batch of URLs starts each one from the same file and writes
storage-1.json,storage-2.json, and so on, beside it. - The file is written readable by its owner only.
Under --server or --cdp, the file is a default that is never written, read again for each request or browser context. A request’s with_storage chooses what it starts from:
with_ | Starts from | Linked from the response |
|---|---|---|
| absent | the server’s default | no |
true | the server’s default, or empty without one | yes |
| a storage object | that object | yes |
false | nothing | no |
Example
zshot -f page.png \
--storage session.json \
https://zshot-cli.com/example_assets/hello_zshot/{
"url": "https://zshot-cli.com/example_assets/hello_zshot/",
"output_type": "png",
"with_storage": {
"cookies": [],
"origins": [{"origin": "https://zshot-cli.com", "localStorage": [{"name": "theme", "value": "dark"}]}]
}
}curl -X POST http://127.0.0.1:3000/ \
-H "Content-Type: application/json" \
-d '{"url":"https://zshot-cli.com/example_assets/hello_zshot/","output_type":"png","with_storage":{"cookies":[],"origins":[{"origin":"https://zshot-cli.com","localStorage":[{"name":"theme","value":"dark"}]}]}}' \
-o page.png