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 🙏

© 2024 – Pkg Stats / Ryan Hefner

mbtiles-server

v3.3.4

Published

Provides a compatible WMTS Tile Server from MBTiles.

Downloads

164

Readme

MBTiles Server

Build Status Coverage Status npm version MIT licensed

Standard - JavaScript Style Guide

Provides a compatible WMTS Tile Server from MBTiles.

Install

$ npm install -g mbtiles-server

Quickstart

$ mbtiles-server --cache /Users/mac/mbtiles --verbose --port 3000
MBTiles Server Service

  cache:         /Users/mac/mbtiles
  protocol:      http
  port:          3000
  domain:        localhost
  verbose:       true

Benchmark

  • 1 Active User => 400 requests/min
  • 1 Passive User => 50 requests/min

| Requests | Response Time | |-----|-----------| | 1 | 33.460ms | | 10 | 45.223ms | | 100 | 374.217ms | | 1K | 2.698s | | 10K | 25.457s |

Total 24,000 requests / min

Using mbtiles-server you could easily sustain 60 active users and up to 480 passive users. These tests were done on the server locally, network traffic and switches could slow down these results significantly.

CLI Help

For any additional help using the CLI, use the --help flag.

  Provides a compatible WMTS Tile Server from MBTiles.

  Usage
    $ mbtiles-server

  Options
    --cache           [~/mbtiles] Cache
    --protocol        [http] Protocol
    --port            [5000] Port
    --domain          [localhost] Domain
    --verbose         [false] Verbose output
    --sslkey          [~/mbtiles/server.key] Path to the file certification (.key). For https protocol only  
    --sslcert         [~/mbtiles/server.cert] Path to the file certification (.cert). For https protocol only
  
  Examples
    $ mbtiles-server --cache /Users/mac/mbtiles --port 5000 --verbose

Environment Variables

Environment variables can be defined instead of entering your options via the CLI.

  • MBTILES_SERVER_CACHE
  • MBTILES_SERVER_PROTOCOL
  • MBTILES_SERVER_PORT
  • MBTILES_SERVER_DOMAIN
  • MBTILES_SERVER_VERBOSE
  • MBTILES_SERVER_SSL_KEY
  • MBTILES_SERVER_SSL_CERT

Docker

A Dockerfile is provided for easy Docker deployment

$ docker build -t mbtiles-server .
$ docker run --rm -it \
  -p 5000:5000 \
  -v ~/mbtiles/:/root/mbtiles \
  mbtiles-server

Start containers automatically

https://docs.docker.com/engine/admin/host_integration/

$ docker run -d \
  --name mbtiles-server \
  -p 5000:5000 \
  -v ~/mbtiles/:/root/mbtiles \
  mbtiles-server

WMTS

The goal of providing a WMTS enabled service is to be performance oriented and scalable. Therefore, servers must be able to return tiles quickly. A good way to achieve that is to use locally stored pre-rendered tiles that will not require any image manipulation or geo-processing.

API

Server

Parameters

  • options [string] Server Options
    • options.cache [string] CACHE file path (optional, default ~/mbtiles)
    • options.domain [string] URL Domain (optional, default 'localhost')
    • options.port [string] URL Port (optional, default 5000)

Examples

server({cache: '/Users/mac/mbtiles', port: 5000, verbose: true})