# get-file-compat

> Get a file from a URL and save it to disk

Latest version **2.4.2** (published 2026-09-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-file-compat
pnpm add get-file-compat
yarn add get-file-compat
bun add get-file-compat
```

## Health

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

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.4.2 |
| Published | 2026-09-15 |
| First published | 2025-12-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=0.8 |
| Dependencies | 4 |
| Unpacked size | 105.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Kevin Malakoff |
| Maintainers | kmalakoff |
| Keywords | exit, process, stdio, stdout, stderr, drain, flush |

## Links

- npm: https://www.npmjs.com/package/get-file-compat
- Repository: https://github.com/kmalakoff/get-file-compat
- Issues: https://github.com/kmalakoff/get-file-compat/issues
- npm.io page: https://npm.io/package/get-file-compat

## Dependencies (4)

- [pump](https://npm.io/package/pump.md) ^3.0.0
- [on-one](https://npm.io/package/on-one.md) ^1.0.0
- [mkdirp-classic](https://npm.io/package/mkdirp-classic.md) ^0.5.2
- [node-version-call-local](https://npm.io/package/node-version-call-local.md) ^1.0.0

## Recent versions

- 2.4.2 (latest) — 2026-09-15
- 2.4.1 — 2026-09-12
- 2.4.0 — 2026-09-05
- 2.3.4 — 2026-08-24
- 2.3.3 — 2026-05-26
- 2.3.2 — 2026-05-22
- 2.3.1 — 2025-12-23
- 2.3.0 — 2025-12-19
- 2.2.2 — 2025-12-18
- 2.2.1 — 2025-12-18
- 2.2.0 — 2025-12-18
- 2.1.0 — 2025-12-18
- 2.0.1 — 2025-12-16
- 2.0.0 — 2025-12-15
- 1.0.0 — 2025-12-15
- … 2 more at https://npm.io/package/get-file-compat/versions

## README

## get-file-compat

Get a file from a URL and save it to disk.

### Installation

```bash
npm install get-file-compat
```

### Usage

```javascript
var path = require('path');
var os = require('os');
var getFile = require('get-file-compat');

getFile('https://nodejs.org/dist/v24.12.0/SHASUMS256.txt', path.join(os.tmpdir(), 'SHASUMS256.txt'), function (err, result) {
  if (err) throw err;
  console.log(result.path);
});
```

The callback result includes the saved `path`, response `headers`, and `statusCode`. The promise form is also available on current Node.js versions.

### API

- `getFile(url, destination[, options], callback)` saves the response and returns `{ path, headers, statusCode }`.
- `getContent(url[, encoding][, options], callback)` returns response content and metadata.
- `getStream(url[, options], callback)` returns the response as a readable stream.
- `head(url[, options], callback)` returns `{ statusCode, headers }` without downloading the body.

Each function also has a promise form where supported by the runtime.

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