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

@maptiler/upload-js

v1.0.1

Published

<img src="https://raw.githubusercontent.com/maptiler/maptiler-sdk-kotlin/main/Examples/maptiler-logo.png" alt="Company Logo" height="32"/>

Downloads

427

Readme

Upload API Library

A TypeScript & Javascript library for handling large file uploads with multipart support and progress tracking. The Upload JS provides a simple way to upload files to MapTiler, track progress, and handle errors.


📖 Documentation   📦 NPM Package   🌐 Website   🔑 Get API Key


📦 Installation

NPM

npm install @maptiler/upload-js

Yarn

yarn add @maptiler/upload-js

🚀 Basic Usage

The UploadAPI class provides a simple way to upload files to MapTiler, track progress, and handle errors. You can use it in any JavaScript or TypeScript project.

Server-side

You have to implement the API endpoints in your backend to proxy requests to MapTiler.

The library expose helper functions designed to simplify server-side integration with MapTiler. They provide ready-to-use route handlers for initializing, processing, replacing, and canceling uploads, so you don’t have to write the fetch logic yourself.

import {
  initUpload,
  processUpload,
  replaceUpload,
  cancelUpload,
} from "@maptiler/upload-js";

All functions require serviceToken – the MapTiler service token is a private key used to authenticate your application with MapTiler services. This token grants access to your MapTiler account and allows your server to perform actions such as uploading files, managing datasets, and more.

[!CAUTION] 🚨 The service token must never be exposed to the client/browser. It should only be used on the server.

[!TIP] See packages/example/app/api how easily the functions can be integrated into your ecosystem.

Client-side

import { HttpStatusCode } from "axios";
import { ApiConfig, OutputType, UploadAPI } from "@maptiler/upload-js";

// The UploadAPI class is a wrapper around the upload process.
const api = await UploadAPI.initialize({
  file, // File
  outputType, // OutputType | null
  onChange: (api: UploadAPI) => {
    // Update your UI with progress or status.
    // api.getProgress()
    // api.getStatus())
  },
  onError: (error: HttpStatusCode, message: string, api: UploadAPI | null) => {
    alert(`${error}, ${message}`);
  },
  // These API endpoints must point to your backend, which can use the provided server-side helpers to
  // proxy requests to  MapTiler.
  initializeURI: datasetID ? `/api/${datasetID}/ingest` : "/api/ingest",
  getProcessURI: (id) => `/api/ingest/${id}/process`,
  getCancelURI: (id) => `/api/ingest/${id}/cancel`,
  // Auto upload, default = true. Upload will start immediately.
  autoUpload: false,
});

// You can now start the upload:
api.start();

// or cancel the upload:
api.cancel();

💡 Related Examples

This repository contains a Next.js example showing how easily you can use this library.

🔑 Prerequisites

Create a .env file in the packages/example directory and add your MapTiler service token:

MAPTILER_SERVICE_TOKEN=<your-own-service-token>

You can find your service token in your MapTiler account.

🐳 Run Development Containers

You can run the entire application inside a development container without installing any dependencies locally.

🖥️ Run Locally

  1. Install Node.js (v18.18 or later).
  2. Install Yarn – see the official guide.
  3. Install dependencies:
yarn install

🚀 Run example

Start the example application in development mode:

yarn example [-p PORT]

Open your browser at http://localhost:3000 (or your chosen port).

📘 API Reference

For detailed guides, API reference, and advanced examples, visit our comprehensive documentation:

API documentation

💬 Support


🤝 Contributing

We love contributions from the community! Whether it's bug reports, feature requests, or pull requests, all contributions are welcome:

  • Fork the repository and create your branch from main
  • If you've added code, add tests that cover your changes
  • Ensure your code follows our style guidelines
  • Give your pull request a clear, descriptive summary
  • Open a Pull Request with a comprehensive description

📄 License

This project is licensed under the BSD 3-Clause License – see the LICENSE file for details.