New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@mapbox/mapbox-file-sniff

Package Overview
Dependencies
Maintainers
28
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/mapbox-file-sniff

Detects type of spatial file

latest
Source
npmnpm
Version
1.0.6
Version published
Maintainers
28
Created
Source

Mapbox File Sniff Build Status

Node module that returns a spatial filetype and protocol.

File types:

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

Protocols (matching tilelive protocols):

Install

With npm:

npm install @mapbox/mapbox-file-sniff

Usage

var sniffer = require('@mapbox/mapbox-file-sniff');

Javascript

fromBuffer(Buffer) - Sniff a file from a buffer.

var buffer = fs.readFileSync('path/to/data/file.geojson');
sniffer.fromBuffer(buffer, function(err, info) {
	if (err) throw err;
	console.log(info);
	// {
	//   protocol: 'omnivore:',
	//   type: 'geojson'
	// }
});

fromFile(String) - Sniff a file from a file path.

var file = './path/to/data/file.geojson';
sniffer.fromFile(file, function(err, info) {
	if (err) throw err;
	console.log(info);
	// {
	//   protocol: 'omnivore:',
	//   type: 'geojson'
	// }
});

CLI

$ mapbox-file-sniff path/to/data/file.geojson
# {"protocol":"omnivore:","type":"geojson"}
$ mapbox-file-sniff path/to/data/file.geojson --type
# geojson
$ mapbox-file-sniff path/to/data/file.geojson --protocol
# omnivore:

Tests

Full test suite:

npm test

Keywords

mapbox

FAQs

Package last updated on 14 Jul 2023

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