# @chunkd/source-file

> Load chunks of data from a file using `node:fs`

Latest version **11.2.1** (published 2026-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @chunkd/source-file
pnpm add @chunkd/source-file
yarn add @chunkd/source-file
bun add @chunkd/source-file
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 11.2.1 |
| Published | 2026-05-23 |
| First published | 2021-07-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16.0.0 |
| Dependencies | 1 |
| Unpacked size | 12.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | Blayne Chard |
| Maintainers | blacha |

## Links

- npm: https://www.npmjs.com/package/@chunkd/source-file
- Repository: https://github.com/blacha/chunkd
- Homepage: https://github.com/blacha/chunkd#readme
- Issues: https://github.com/blacha/chunkd/issues
- npm.io page: https://npm.io/package/@chunkd/source-file

## Dependencies (1)

- [@chunkd/source](https://npm.io/package/@chunkd/source.md) ^11.4.1

## Recent versions

- 11.2.1 (latest) — 2026-05-23
- 11.2.0 — 2026-03-26
- 11.1.0 — 2026-03-24
- 11.0.2 — 2026-03-03
- 11.0.1 — 2023-08-23
- 11.0.0 — 2023-07-20
- 10.0.6 — 2023-05-05
- 10.0.5 — 2023-05-01
- 10.0.3 — 2023-04-27
- 10.0.2 — 2023-01-17
- 10.0.1 — 2023-01-17
- 10.0.0 — 2022-09-22
- 8.4.0 — 2022-06-21
- 8.3.0 — 2022-06-08
- 8.2.0 — 2022-05-11
- … 17 more at https://npm.io/package/@chunkd/source-file/versions

## README

# @chunkd/source-file

Load chunks of data from a file using `node:fs`

## Usage

```javascript
import { pathToFileURL } from 'node:path';
import { SourceFile } from '@chunkd/source-file';

const source = new SourceFile(pathToFileURL('./cog.tif'));

// Read in the first 1KB of data
await source.fetch(0, 1024);

// Read the last 1KB of data
await source.fetch(-1024);
```

### Advanced Usage

For caching, block alignment and fetch grouping see [@chunkd/middleware](https://www.npmjs.com/package/@chunkd/middleware) and [@chunkd/fs](https://www.npmjs.com/package/@chunkd/fs)

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