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

csv2geo-sdk

v1.0.0

Published

Node.js SDK for CSV2GEO Geocoding API

Readme

CSV2GEO Node.js SDK

npm version Node.js versions License: MIT

Official Node.js SDK for the CSV2GEO Geocoding API - fast, accurate geocoding powered by 446M+ addresses worldwide.

Installation

npm install csv2geo-sdk

Quick Start

const { Client } = require('csv2geo-sdk');

// Initialize with your API key
const client = new Client('your_api_key');

// Forward geocoding (address → coordinates)
const result = await client.geocode('1600 Pennsylvania Ave, Washington DC');
if (result) {
  console.log(`Lat: ${result.lat}, Lng: ${result.lng}`);
  console.log(`Address: ${result.formattedAddress}`);
}

// Reverse geocoding (coordinates → address)
const result = await client.reverse(38.8977, -77.0365);
if (result) {
  console.log(`Address: ${result.formattedAddress}`);
}

Features

  • Forward geocoding - Convert addresses to coordinates
  • Reverse geocoding - Convert coordinates to addresses
  • Batch processing - Geocode up to 10,000 addresses per request
  • Auto-retry - Automatic retry on rate limits
  • TypeScript support - Full type definitions included
  • Zero dependencies - Uses native fetch (Node.js 18+)

API Reference

Initialize Client

const { Client } = require('csv2geo-sdk');

const client = new Client('your_api_key', {
  baseUrl: 'https://api.csv2geo.com/v1',  // optional
  timeout: 30000,  // optional, milliseconds
  autoRetry: true,  // optional, retry on rate limit
});

Forward Geocoding

// Simple - returns best match or null
const result = await client.geocode('1600 Pennsylvania Ave, Washington DC');

// With country filter
const result = await client.geocode('123 Main St', { country: 'US' });

// Full response with all matches
const response = await client.geocodeFull('1600 Pennsylvania Ave');
for (const result of response.results) {
  console.log(`${result.formattedAddress}: ${result.accuracyScore}`);
}

Reverse Geocoding

// Simple - returns best match or null
const result = await client.reverse(38.8977, -77.0365);

// Full response with all matches
const response = await client.reverseFull(38.8977, -77.0365);

Batch Geocoding

// Geocode multiple addresses (up to 10,000)
const addresses = [
  '1600 Pennsylvania Ave, Washington DC',
  '350 Fifth Avenue, New York, NY',
  '1 Infinite Loop, Cupertino, CA',
];

const results = await client.geocodeBatch(addresses);
for (const response of results) {
  const best = response.results[0];
  if (best) {
    console.log(`${response.query}: ${best.lat}, ${best.lng}`);
  } else {
    console.log(`${response.query}: Not found`);
  }
}

Batch Reverse Geocoding

// Reverse geocode multiple coordinates
const coordinates = [
  { lat: 38.8977, lng: -77.0365 },
  { lat: 40.7484, lng: -73.9857 },
];

const results = await client.reverseBatch(coordinates);
for (const response of results) {
  const best = response.results[0];
  if (best) {
    console.log(best.formattedAddress);
  }
}

GeocodeResult Object

const result = await client.geocode('1600 Pennsylvania Ave, Washington DC');

// Coordinates
result.lat              // 38.8977
result.lng              // -77.0365

// Address
result.formattedAddress  // "1600 PENNSYLVANIA AVE NW, WASHINGTON, DC 20500, US"
result.accuracy          // "rooftop"
result.accuracyScore     // 1.0

// Components
result.components.houseNumber  // "1600"
result.components.street       // "PENNSYLVANIA AVE NW"
result.components.city         // "WASHINGTON"
result.components.state        // "DC"
result.components.postcode     // "20500"
result.components.country      // "US"

Error Handling

const { Client, AuthenticationError, RateLimitError, InvalidRequestError } = require('csv2geo-sdk');

const client = new Client('your_api_key');

try {
  const result = await client.geocode('123 Main St');
} catch (err) {
  if (err instanceof AuthenticationError) {
    console.log(`Invalid API key: ${err.message}`);
  } else if (err instanceof RateLimitError) {
    console.log(`Rate limited. Retry after ${err.retryAfter} seconds`);
  } else if (err instanceof InvalidRequestError) {
    console.log(`Invalid request: ${err.message}`);
  }
}

Rate Limits

The client tracks rate limit headers automatically:

await client.geocode('123 Main St');

console.log(client.rateLimit);            // Max requests per minute
console.log(client.rateLimitRemaining);   // Requests remaining
console.log(client.rateLimitReset);       // Unix timestamp when limit resets

With autoRetry: true (default), the client automatically waits and retries when rate limited.

TypeScript

Full TypeScript support is included:

import { Client, GeocodeResult, GeocodeResponse } from 'csv2geo-sdk';

const client = new Client('your_api_key');
const result: GeocodeResult | null = await client.geocode('123 Main St');

Requirements

  • Node.js 16+ (uses native fetch)

Get Your API Key

Sign up at csv2geo.com to get your API key.

Documentation

License

MIT License - see LICENSE for details.