# read-cache

> Reads and caches the entire contents of a file until it is modified

Latest version **1.0.2** (published 2026-08-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install read-cache
pnpm add read-cache
yarn add read-cache
bun add read-cache
```

## Health

**Score 60/100 (C)** — status: active.

Positive: no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2026-08-19 |
| First published | 2016-01-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 11 |
| Author | Bogdan Chadkin |
| Maintainers | trysound |
| Keywords | fs, read, cache |

## Links

- npm: https://www.npmjs.com/package/read-cache
- Repository: https://github.com/TrySound/read-cache
- Homepage: https://github.com/TrySound/read-cache#readme
- Issues: https://github.com/TrySound/read-cache/issues
- npm.io page: https://npm.io/package/read-cache

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2026-08-19
- 1.0.1 — 2026-08-19
- 1.0.0 — 2016-01-11

## README

# read-cache [![CI](https://github.com/TrySound/read-cache/actions/workflows/ci.yml/badge.svg)](https://github.com/TrySound/read-cache/actions/workflows/ci.yml)

Reads and caches the entire contents of a file until it is modified.


## Install

```
$ npm i read-cache
```


## Usage

```js
// foo.js
var readCache = require('read-cache');

readCache('foo.js').then(function (contents) {
	console.log(contents);
});
```


## API

### readCache(path[, encoding])

Returns a promise that resolves with the file's contents.

### readCache.sync(path[, encoding])

Returns the content of the file.

### readCache.get(path[, encoding])

Returns the content of cached file or null.

### readCache.clear()

Clears the contents of the cache.


## License

MIT © [Bogdan Chadkin](mailto:opensource@trysound.io)

---
_Source: https://npm.io/package/read-cache · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
