open-index/open-npm huggingface dataset:
npm package: @mapbox/mapbox-events
Description: Send events from the browser to the Mapbox events API.
Author: Mapbox
Latest version: 1.0.0

[![Build Status](https://travis-ci.org/mapbox/mapbox-events.svg?branch=master)](https://travis-ci.org/mapbox/mapbox-events)

Mapbox Events
=============
Send events from the browser to the Mapbox events API.

Each call to `push()` is batched. Batches are flushed and sent to the server
when the size of the batch reaches the `flushAt` threshold or when the time
since the last event was pushed reaches the `flushAfter` threshold.

## Example

```javascript
var events = require('@mapbox/mapbox-events')({
    token: 'mapbox api token',
    flushAt: 20,
    flushAfter: 10000
});

events.push({
    event: 'foo',
    attribute1: 'foo',
    attribute2: 'bar'
});
```
npm package: @mapbox/mapbox-file-sniff
Description: Detects type of spatial file
Author: Carol B. Hansen
Latest version: 1.0.6

![](mapbox-file-sniff.jpg)

## Mapbox File Sniff [![Build Status](https://travis-ci.com/mapbox/mapbox-file-sniff.svg?branch=master)](https://travis-ci.com/mapbox/mapbox-file-sniff)

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):

- `omnivore:` [tilelive-omnivore](https://github.com/mapbox/tilelive-omnivore)
- `mbtiles:` [node-mbtiles](https://github.com/mapbox/node-mbtiles)
- `tilejson:` [node-tilejson](https://github.com/mapbox/node-tilejson)
- `serialtiles`: *special case*
- `tm2z`: [tilelive-vector](https://github.com/mapbox/tilelive-vector)

# Install

With npm:
```
npm install @mapbox/mapbox-file-sniff
```

# Usage

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

### Javascript

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

```javascript
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.

```javascript
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

```sh
$ 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`