npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

leaflet-better-filelayer

v2.0.0

Published

Load spatialized files into leaflet using the HTML FileReader API

Readme

Leaflet.BetterFileLayer

Load your spatialized files into Leaflet the way it should be.

npm downloads license GitHub Workflow Status


This is a Leaflet plugin for loading your spatialized data into leaflet based on leaflet-omnivore and Leaflet.FileLayer plugins. This plugin was made looking for a convenient and easy to use plugin for loading external spatial files to leaflet.

It currently supports:

Installation

For Leaflet 2.x

npm install leaflet-better-filelayer

For Leaflet 1.x

npm install [email protected]

Demo

Checkout the Demo

Checkout the Demo with external button

Below gif show an example of loading a separated shapefile using drag and drop.

Note: Internally, the plugin groups .shp, .dbf, .shx and .prj with the same name.

example

Usage

import { BetterFileLayer } from "leaflet-better-filelayer";

const map = new Map('map');

const bfl = new BetterFileLayer();

map.addControl(bfl);

Documentation

For Leaflet 2.x

Go to Wiki page

For Leaflet 1.x

Go to Wiki page

And

Go to 1.0.1 tag

Typescript support

event_types event_types event_types

Custom html button

If you are developing a web application and you want to use your own html button outside the map container, you can use the following code:

// Note: The input have to be type "file"
// Example: <input type="file" accept=".gpx,.kml,.geojson,.json" multiple />
const options = {
  button: document.getElementById('my-button'), // Your input HTML reference
}

const bfl = new BetterFileLayer(options).addTo(map);

After that, the plugin will bind an "on change" event on this button, waiting for files.

You can see the example here

Note: The Drag and Drop event listener will bind it self automatically

Development

Install the development dependencies

npm install --save-dev

Start Vite development mode

npm run dev

Open localhost:3000 in your browser and start editing index.html.

Test

To run unity tests:

npm run test

Linting & Code Style

npm run style && npm run lint

Contributors

License

  • Copyright (c) 2026, Gabriel Russo
  • Copyright (c) 2014, Mapbox
  • Copyright (c) 2012, Michael Bostock
  • Copyright (c) 2012 Makina Corpus

See License for more details