Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mapbox-file-sniff

Package Overview
Dependencies
Maintainers
26
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapbox-file-sniff

Detects type of spatial file

  • 0.3.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
increased by37.5%
Maintainers
26
Weekly downloads
 
Created
Source

mapbox-file-sniff

Node module that returns spatial filetype.

Version format follows Semantic Version

Build Status

Install

With npm:

npm install -g mapbox-file-sniff

Example, in JavaScript

var filesniffer = require('mapbox-file-sniff');
var buffer = fs.readFileSync('path/to/data/file.geojson');

filesniffer.sniff(buffer, function(err, filetype){
	assert.equal(filetype, 'geojson');
});

filesniffer.waft(buffer, function(err, protocol) {
	assert.equal(protocol, 'omnivore:');
});

Example, in bash

$ mapbox-file-type path/to/data/file.geojson
# geojson
$ mapbox-file-protocol path/to/data/file.geojson
# omnivore:
  • buffer: Buffer object of file contents (at least length 300)

.sniff returns a string for the following filetypes:

  • Zipped shapefile: zip
  • Unziped shapefile: shp
  • GPX: gpx
  • KML: kml
  • GeoJSON: geojson
  • GeoTIFF: tif
  • Mbtiles: mbtiles
  • TileJSON: tilejson
  • Serialtiles: serialtiles
  • tm2z: tm2z

.waft returns a string for the following tilelive protocols:

Tests

npm test

Keywords

FAQs

Package last updated on 20 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc