---
title: "content.refresh()"
description: "Re-read the source, repopulate the cache, and drop vanished entries."
canonical_url: "https://content.comark.dev/reference/content/refresh"
---
# content.refresh()

> Re-read the source, repopulate the cache, and drop vanished entries.

## `content.refresh()`{lang="ts"}

Re-reads the instance's source, bypassing caches, and reconciles the result: parsed bodies are cached, the index is re-stamped, and entries whose files disappeared are evicted.

```ts [refresh.ts]
const files = await content.refresh()
files.length // every file re-read from the source
```

### Returns

`Promise<ContentFile[]>`{lang="ts"} — the freshly parsed files.

## When to call it

Use it when content changed and nothing told the instance:

- a webhook reports a push to a [GitHub source](https://content.comark.dev/sources/github)
- a long-lived process must pick up edits without a restart
- a build step wants current data before [`snapshot()`](https://content.comark.dev/reference/content/snapshot)

Locally you rarely need it, because [`content.watch()`](https://content.comark.dev/reference/content/watch) keeps the index in step with file changes.

## Behaviour

- **Evicts what vanished.** Entries missing from the re-read are removed from the index and the cache, so a deleted file stops resolving.
- **Re-stamps the index.** The persisted index becomes newer than any build-time artifact, so a later cold start prefers it.
- **Invalidates HTTP artifacts.** The next `/manifest` or `/snapshot` request rebuilds — see [`content.handler()`](https://content.comark.dev/reference/content/handler).
- **Parsed sources re-fetch.** With no raw origin, a [snapshot source](https://content.comark.dev/sources/snapshot) re-reads its provider instead.
- **An unreachable origin can't roll the index back.** When the raw origin fails and the snapshot is older than the index (runtime edits happened since the build), the index stays as it is: no eviction, no re-stamp. The snapshot only refills bodies that still [belong to their index entry](https://content.comark.dev/advanced/artifacts-and-hydration#which-bodies-hydrate). The returned array holds those bodies.
- **No provider, no work.** An instance with neither a source nor a parsed provider returns an empty array rather than emptying itself.

::note
Under stale-while-revalidate, an expired content entry triggers this in the background, so a request serves the stale value while the source is re-read. See [caching](https://content.comark.dev/advanced/caching).
::


## Sitemap

See the full [sitemap](https://content.comark.dev/sitemap.md) for all pages.
