# proto-fetch

> Protocol handler wrapper for fetch

Latest version **2.0.0** (published 2023-11-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install proto-fetch
pnpm add proto-fetch
yarn add proto-fetch
bun add proto-fetch
```

## Health

**Score 43/100 (D)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2023-11-19 |
| First published | 2017-10-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/proto-fetch) |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Thomas Bergwinkl |
| Maintainers | bergos |
| Keywords | fetch, file, fs, readable, stream |

## Links

- npm: https://www.npmjs.com/package/proto-fetch
- Repository: https://github.com/bergos/proto-fetch
- Issues: https://github.com/bergos/proto-fetch/issues
- npm.io page: https://npm.io/package/proto-fetch

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2023-11-19
- 1.0.0 — 2017-10-18

## README

# proto-fetch

[![build status](https://img.shields.io/github/actions/workflow/status/bergos/proto-fetch/test.yaml?branch=master)](https://github.com/bergos/proto-fetch/actions/workflows/test.yaml)
[![npm version](https://img.shields.io/npm/v/proto-fetch.svg)](https://www.npmjs.com/package/proto-fetch)

A protocol handler wrapper for fetch.

## Usage

`proto-fetch` doesn't contain any fetch implementations.
A map of protocol to implementation must be given to the constructor.
This example shows how to create a fetch for file, http and https URLs:

```javascript
import fileFetch from 'file-fetch'
import httpFetch from 'nodeify-fetch'
import protoFetch from 'proto-fetch'

const fetch = protoFetch({
  [null]: fileFetch,
  file: fileFetch,
  http: httpFetch,
  https: httpFetch
})

const res = await fetch(`file://${process.cwd()}/package.json`)
```

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