# runtime/entrypoints/snapshot.entrypoint.ts

> 18 lines of code and 2 definitions.

Tree: Project Scripts
Language: typescript
Layer: runtime
Canonical: https://banes-lab.com/anatomy/scripts#file-scripts-runtime-entrypoints-snapshot-entrypoint-ts
Source text: https://banes-lab.com/source/scripts/runtime/entrypoints/snapshot.entrypoint.ts.txt

Listed in [runtime/entrypoints](https://banes-lab.com/api/source/scripts/runtime/entrypoints.md), after [runtime/entrypoints/server.entrypoint.ts](https://banes-lab.com/source/scripts/runtime/entrypoints/server.entrypoint.ts.md) and before [runtime/entrypoints/source.entrypoint.ts](https://banes-lab.com/source/scripts/runtime/entrypoints/source.entrypoint.ts.md).

## Definitions

- `options` (lexical_declaration, line 9)
- `binary` (lexical_declaration, line 10)

## Contained in

- [runtime/entrypoints](https://banes-lab.com/anatomy/scripts/folder-scripts-runtime-entrypoints.md)

## Source

```typescript
import { NO_BROWSER, REFUSED_ARGUMENTS } from "#configuration/strings/snapshot.strings";
import { SNAPSHOT_ARGV } from "#configuration/configs/snapshot.config";
import { capturePage } from "#core/coordinators/snapshot.coordinator";
import { findBrowser } from "@banes-lab/build-scripts/core/resolvers/browser.resolver.ts";
import process from "node:process";
import { readOptions } from "#core/converters/snapshot.converter";
import { resolveArgv } from "@govlab/argv";

const options = readOptions(resolveArgv(SNAPSHOT_ARGV));
const binary = options === null ? null : findBrowser(options.browser);

if (options === null) {
    process.stderr.write(REFUSED_ARGUMENTS);
    process.exitCode = 1;
} else if (binary === null) {
    process.stderr.write(NO_BROWSER);
    process.exitCode = 1;
} else {
    process.exitCode = (await capturePage(binary, options)) ? 0 : 1;
}
```
