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

idn-area-extractor

v0.5.1

Published

Extract Indonesia area data from the raw sources to CSV

Downloads

21

Readme

Extract Indonesia area data from the raw sources to CSV.

This package was developed to ease and speed up the data processing stage of idn-area-data.

Prerequisite

  • Node.js 18 or later
  • npm 9 or later

Installation

idn-area-extractor can be installed in the global scope (if you'd like to have it available and use it on the whole system) or locally for a specific package (especially if you'd like to use it programmatically):

Install globally:

npm install -g idn-area-extractor

Install locally:

npm install idn-area-extractor

Usage

Access the manual with idnxtr --help command:

USAGE
  $ idnxtr [regencies|districts|islands|villages] </path/to/file.[pdf|txt]> [OPTIONS]

OPTIONS
  -c, --compare             Compare the extracted data with the latest data
  -d, --destination=<path>  Set the folder destination. Default: current working directory
  -o, --output=<filename>   Set a specific output file name without the file extension
  -r, --range=<range>       Extract specific PDF pages (e.g. 1-2,5,7-10)
  -R, --save-raw            Save the extracted raw data into .txt file (only works with PDF data)
      --silent              Disable all logs

EXAMPLE
  $ idnxtr
  $ idnxtr regencies ~/data/regencies.pdf
  $ idnxtr regencies ~/data/regencies.pdf -r 1-2,5,7-10 -R
  $ idnxtr regencies ~/data/regencies.pdf --range 1-2,5,7-10 --save-raw
  $ idnxtr regencies ~/data/raw-regencies.txt

Interactive UI

Run idnxtr without arguments to launch the interactive UI that guides you to extracting the data.

Screenshot UI

API

idn-area-extractor can be used programmatically by using the API documented below:

idnxtr(options)

Extract the data from the PDF file.

options

Required:

  • options.data: Which kind of data should be extracted, either 'regencies', 'districts', 'islands', or 'villages'.
  • options.filePath: The path to the PDF or TXT file.

Optional:

  • options.compare: Compare the extracted data with the latest data. Default: false.
  • options.destination: The destination folder to save the CSV file. Default: process.cwd().
  • options.output: The output file name without the file extension. Default: options.data.
  • options.range: Extract specific PDF pages (e.g. 1-2,5,7-10). If not set, all pages will extracted.
  • options.saveRaw: Save the extracted raw data into .txt file (only works with PDF data). Default: false.
  • options.silent: Disable all logs. Default: false.

Example

ESM

// .js
import idnxtr from 'idn-area-extractor';

(async () => {
  await idnxtr({
    data: 'regencies',
    filePath: '/path/to/regencies.pdf',
    compare: true,
    destination: '/path/to/destination',
    output: 'regencies',
    range: '1-2,5,7-10',
    saveRaw: true,
    silent: true,
  });
})();

CommonJS

For CommonJS user, you need to use dynamic import like this:

// .js
(async () => {
  const {default: idnxtr} = await import('idn-area-extractor')

  await idnxtr({
    // options...
  })
})()

Problem Reporting

We have different channels for each problem, please use them by following these conditions :

Reporting a Bug

To report a bug, please open a new issue following the guide.

Requesting a New Feature

If you have a new feature in mind, please open a new issue following the guide.

Asking a Question

If you have a question, you can search for answers in the GitHub Discussions Q&A category. If you don't find a relevant discussion already, you can open a new discussion.

Support This Project

Give a ⭐️ if this project helped you!

You can support this project by donating via GitHub Sponsor, Trakteer, or Saweria.