0.9.3 • Published 2 years ago

gcfixer v0.9.3

Weekly downloads
6
License
GPL-3.0
Repository
github
Last release
2 years ago

GCFIXER

NPM Stats

npm.io npm.io npm.io npm.io

GCFixer is command line tool for normalistaion of geocaching pocket queries (PQ) in GPX format to use with Garmin devices. GPX parser in Garmin devices is not perfect and can have problems with not well formed or compilcated HTML descriptions. Also PQ can contain rich text formatted logs and this can sometimes render them unreadable.

What tool does:

  • Simplify HTML code in cache description and fix potential errors (or optionally remove HTML formating)
  • Replace internationalised diacritic to simple ASCII
  • Replace emojis with ASCII emoticons if possible

Installation

You can choose to use published version from npmjs.com or directly clone project from GitHub

Install from NPMJS

npm install -g gcfixer

Installation from Git

  • You need NodeJS to be installed on your computer.
  • Clone repository or download zip:
    git clone https://github.com/dullus/gcfixer.git
  • Install it
    cd gcfixer
    npm install -g .
  • Run it

    gcfixer --help

    will output:

    Usage: -i <infile> [-o <outfile>]
    
    Options:
      --help        Show help                            [boolean]
      --version     Show version number                  [boolean]
      -i, --input   Input file                 [string] [required]
      -o, --output  Output file                           [string]
      -h, --html    strip html                           [boolean]
      -s, --stdout  pipe result to stdout                [boolean]

Sample usage

# Process file GC12345.gpx and save output to GC12345.out.gpx:
gcfixer -i GC12345.gpx

# Process file GC12345.gpx, strip html from description to plaintext and save output to output.gpx:
gcfixer -i GC12345.gpx -o output.gpx -h

# Process file GC12345.gpx and output to stdout:
gcfixer -i GC12345.gpx -s

Uninstall

npm uninstall -g gcfixer

API

You can use GCFixer directly as library without CLI interface in your project.

npm install --save gcfixer

Then include in your project (TypeScript example):

import { Process } from 'gcfixer/src/Process';
// configure options
const params = {
  stdout: true, // matches -s switch
  stripHtml: false // matches -h switch
};
// create instance
const process = new Process('input.gpx', params);
// add some code to capture STDOUT, or use temporary file
...
// run conversion
process.run().then(
  (caches: number) => { /* .. promise resolved handler */ },
  () => { /* .. promise rejected handler */ }
);