# @mapbox/tiletype

> detect common map tile formats from a buffer

Latest version **0.3.1** (published 2017-01-25) · 0 weekly downloads

## Install

```sh
npm install @mapbox/tiletype
pnpm add @mapbox/tiletype
yarn add @mapbox/tiletype
bun add @mapbox/tiletype
```

Provides the command `tiletype`.

## Health

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

Positive: has types; no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2017-01-25 |
| First published | 2016-12-02 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Mapbox |
| Maintainers | aaronlidman, aarthykc, ajithranka, aliceykuo, alinapaz, alulsh, amishas157, amyleew, andreasviglakis, ansis, aparlato, apendleton, arunasank, batpad, benjamintd, bhousel, bkowshik, brendanmcfarland, bsrinivasa, bsudekum, camillacaros, captainbarbosa, chaupow, colleenmcginnis, danieljh, danpat, danswick, dasulit, davidtheclark, dnomadb, dthompson, emilymcafee, emilymdubois, enf, freenerd, geohacker, ghoshkaj, gretacb, ian29, ianshward, ingalls, isiyu, jacquestardie, jfirebaugh, jothirnadh, jrpruit1, k-mahoney, kaibot3000, kaidalgleish, karenzshea, karitotp, katydecorah, kkaefer, l-r, laurier, lbud, lily-chai, lucaswoj, lxbarth, lyzidiamond, maning, mapbox-admin, mapsam, mateov, mattficke, mayaqgao, mcwhittemore, miccolis, miles-dev, mokob, mollymerp, morganherlocker, mourner, msirenko, natslaughter, nickcordella, nickidlugash, oini, oxidase, pdgoodman, perrygeo, planemad, pratikyadav, rclark, rodowi, rub21, rumc, ryan-baumann, saikia.abhishek, samanbb, sbma44, scothis, springmeyer, srividyacb, tcql, themarex, tmcw, tony-cj, tristen, uvollmer, vincents, virginiayung, who8mycakes, willwhite, xrwang, yhahn, yunjieli, zmully |

## Links

- npm: https://www.npmjs.com/package/@mapbox/tiletype
- Repository: https://github.com/mapbox/tiletype
- Homepage: https://github.com/mapbox/tiletype#readme
- Issues: https://github.com/mapbox/tiletype/issues
- npm.io page: https://npm.io/package/@mapbox/tiletype

## Recent versions

- 0.3.1 (latest) — 2017-01-25
- 0.3.0 — 2016-12-02

## README

# tiletype

[![build status](https://secure.travis-ci.org/mapbox/tiletype.png)](http://travis-ci.org/mapbox/tiletype)
[![Coverage Status](https://coveralls.io/repos/mapbox/tiletype/badge.svg?branch=coverage&service=github)](https://coveralls.io/github/mapbox/tiletype?branch=coverage)

detect common map tile formats from a buffer


### `type(buffer)`

Given a buffer of unknown data, return either a format as an extension
string or false if the type cannot be determined.

Potential options are:

* png
* pbf
* jpg
* webp


### Parameters

| parameter | type   | description |
| --------- | ------ | ----------- |
| `buffer`  | Buffer | input       |



**Returns** `String,boolean`, identifier


### `headers(buffer)`

Return headers - Content-Type and Content-Encoding -
for a response containing this kind of image.


### Parameters

| parameter | type   | description |
| --------- | ------ | ----------- |
| `buffer`  | Buffer | input       |



**Returns** `Object`, headers


### `dimensions(buffer, dimensions)`

Determine the width and height of an image contained in a buffer,
returned as a [x, y] array.


### Parameters

| parameter    | type           | description |
| ------------ | -------------- | ----------- |
| `buffer`     | Buffer         | input       |
| `dimensions` | Array\,boolean |             |


## Installation

Requires [nodejs](http://nodejs.org/).

```sh
$ npm install @mapbox/tiletype
```

## Tests

```sh
$ npm test
```

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