# tilelive-streaming

> Streaming functionality for tilelive modules

Latest version **0.7.7** (published 2017-06-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install tilelive-streaming
pnpm add tilelive-streaming
yarn add tilelive-streaming
bun add tilelive-streaming
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.7 |
| Published | 2017-06-14 |
| First published | 2014-06-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Seth Fitzsimmons |
| Maintainers | mojodna |

## Links

- npm: https://www.npmjs.com/package/tilelive-streaming
- Repository: https://github.com/mojodna/tilelive-streaming
- Homepage: https://github.com/mojodna/tilelive-streaming#readme
- Issues: https://github.com/mojodna/tilelive-streaming/issues
- npm.io page: https://npm.io/package/tilelive-streaming

## Dependencies (5)

- [async](https://npm.io/package/async.md) ^1.5.2
- [debug](https://npm.io/package/debug.md) ^2.2.0
- [highland](https://npm.io/package/highland.md) ^2.0.0
- [@mapbox/tiletype](https://npm.io/package/@mapbox/tiletype.md) ^0.3.0
- [@mapbox/sphericalmercator](https://npm.io/package/@mapbox/sphericalmercator.md) ^1.0.2

## Recent versions

- 0.7.7 (latest) — 2017-06-14
- 0.7.6 — 2017-06-14
- 0.7.5 — 2017-04-17
- 0.7.4 — 2016-05-05
- 0.7.3 — 2016-05-05
- 0.7.2 — 2016-03-16
- 0.7.1 — 2016-03-16
- 0.7.0 — 2016-03-15
- 0.6.4 — 2016-03-15
- 0.6.3 — 2016-03-11
- 0.6.2 — 2016-03-05
- 0.6.1 — 2016-02-15
- 0.6.0 — 2016-01-08
- 0.5.3 — 2016-01-08
- 0.5.2 — 2015-10-22
- … 13 more at https://npm.io/package/tilelive-streaming/versions

## README

# tilelive-streaming

A [tilelive](https://github.com/mapbox/tilelive.js) wrapper that transparently
adds streaming functionality to providers.

## About

This module adds `createReadStream` and `createWriteStream` methods to
providers that support `getTile` and `putTile` respectively. Default
functionality uses a `tilelive.Scheme` to generate a set of `getTile` requests,
outputting a stream of streams containing tile data.

## Usage

```javascript
var tilelive = require("tilelive-streaming")(require("@mapbox/tilelive"), {
  concurrency: 8
});
require("@mapbox/mbtiles").registerProtocols(tilelive);

tilelive.load("mbtiles://./in.mbtiles", function(err, source) {
  return tilelive.load("mbtiles://./out.mbtiles", function(err, sink) {
    source.createReadStream().pipe(sink.createWriteStream());
  });
});
```

## Options

`createReadStream` passes its options into a `tilelive.Scheme` subclass
(specified by `sourceConfig.scheme`, defaulting to `scanline`), so the documentation
for that takes precedence.  In practice, `minzoom`, `maxzoom`, and `bounds` are
likely candidates, as they can be used for filtering.

`createWriteStream` accepts an `info` option containing TileJSON.  Its values
will overwrite any info provided by the source (when appropriate).

## Events

Writable streams will emit `tile` events (containing `z`, `x`, `y`, `headers`,
and `data` properties) when data for a given tile has been fully received.

Readable streams will emit `info` events once it has been loaded (usually
before tile data begins being sent).

## Overriding Default Implementations

`lib/` contains specific implementations for providers that do not (yet)
support streaming natively and where the default behavior can be improved upon.
[`mbtiles`](https://github.com/mapbox/node-mbtiles) is a good example of this,
as the actual list of tiles present can be determined directly from the source
(rather than scanning a bounding box and zoom range for possible candidates).

### MBTiles

`mbtiles`' `createReadStream` accepts a `batchSize` argument that allows the
number of tiles read from the underlying SQLite3 database at a time to be
specified.

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