# fs-read-stream-over-http

> Isomorphic fs.createReadStream, works in Node and in the browser.

Latest version **0.2.2** (published 2019-12-28) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install fs-read-stream-over-http
pnpm add fs-read-stream-over-http
yarn add fs-read-stream-over-http
bun add fs-read-stream-over-http
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2019-12-28 |
| First published | 2017-11-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 0 |
| Unpacked size | 9.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Jannis R |
| Maintainers | derhuerst |
| Keywords | fs, createReadStream, fetch, ajax, xhr, http |

## Links

- npm: https://www.npmjs.com/package/fs-read-stream-over-http
- Repository: https://github.com/derhuerst/fs-read-stream-over-http
- Issues: https://github.com/derhuerst/fs-read-stream-over-http/issues
- npm.io page: https://npm.io/package/fs-read-stream-over-http

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.2.2 (latest) — 2019-12-28
- 0.2.1 — 2017-11-28
- 0.2.0 — 2017-11-28
- 0.1.0 — 2017-11-23

## README

# fs-read-stream-over-http

**Deprecated in favor of [`stream-http`](https://github.com/jhiesey/stream-http).**

---

**Isomorphic [`fs.createReadStream`](https://nodejs.org/api/fs.html#fs_fs_createreadstream_path_options).** Delegates to core [`fs`](https://nodejs.org/api/fs.html) in Node, uses the [Browserify](http://browserify.org/) [`http` shim](https://github.com/jhiesey/stream-http) in the browser.

[![npm version](https://img.shields.io/npm/v/fs-read-stream-over-http.svg)](https://www.npmjs.com/package/fs-read-stream-over-http)
[![build status](https://api.travis-ci.org/derhuerst/fs-read-stream-over-http.svg?branch=master)](https://travis-ci.org/derhuerst/fs-read-stream-over-http)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/fs-read-stream-over-http.svg)
[![chat on gitter](https://badges.gitter.im/derhuerst.svg)](https://gitter.im/derhuerst)


## Installing

```shell
npm install fs-read-stream-over-http
```


## Usage

You need to provide a function that maps local paths such as `./foo/bar.txt` to a URL:

```js
const path = require('path')

const pathToUrl = local => 'https://example.org' + path.resolve('/', local)
```

It will be used in the browser, to fetch the file over HTTP. In Node, the local path will be used.

```js
const fsCreateReadStream = require('fs-read-stream-over-http')

fsCreateReadStream('/foo/bar.txt', pathToUrl, {encoding: 'utf8'})
.on('data', console.log)
.once('end', () => console.log('end!'))
```

`fsCreateReadStream` will throw when called with options that can't be fulfilled in the browser (e.g. `flags`). Otherwise it will return a [stream](https://nodejs.org/api/stream.html#stream_readable_streams) of decoded data.


## Contributing

If you have a question or have difficulties using `fs-read-stream-over-http`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to [the issues page](https://github.com/derhuerst/fs-read-stream-over-http/issues).

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