0.3.1 • Published 7 years ago

@mapbox/tiletype v0.3.1

Weekly downloads
1,943
License
-
Repository
github
Last release
7 years ago

tiletype

build status Coverage Status

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

parametertypedescription
bufferBufferinput

Returns String,boolean, identifier

headers(buffer)

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

Parameters

parametertypedescription
bufferBufferinput

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

parametertypedescription
bufferBufferinput
dimensionsArray\,boolean

Installation

Requires nodejs.

$ npm install @mapbox/tiletype

Tests

$ npm test