New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gpx-parser-lite

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gpx-parser-lite

Parses GPX files to JSON

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

GPX Parser Lite 🥳

A lightweight GPX parser

Can either parse a file given a file path or can parse a GPX string. A GPX file is essentially XML.

How to install 😱

npm install --save gpx-parser-lite

Output 💾

There are two main functions parseGPXString and parseGPXFile. The output for both is the same:

interface Activity {
    name: string;
    date: string; // an ISO DATE
    type: number; // 9 is run 🤷‍♂️
    activityDataPoints: Array<{
        latitude: number | null;
        longitude: number | null;
        timestamp: string | undefined;
        elevation: number | null;
        heartRate: number | null;
        cadence: number | null;
    }>
}

Example 🤺

parseGPXString

The context for usage would be along the lines of a perhaps form submittal, where a FileReader can get the file as a string and POST it to an express app:

import { parseGPXString, Activity } from "gpx-parser-lite";

const activity: Activity = parseGPXString(GPX_STRING);

parseGPXFile

The environment here would be node, possibly where the file path could be passed in as a command line argument

import { parseGPXString, Activity } from "gpx-parser-lite";

parseGPXString(GPX_FILE_PATH, (err, activity) => {
    // do something with activity
});

FAQs

Package last updated on 16 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc