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

thredds-catalog-crawler

v0.0.7

Published

A module for crawling thredds catalogs

Downloads

1,540

Readme

thredds-catalog-crawler

A package for crawling THREDDS catalogs, including nested catalogs.

Install

npm install thredds-catalog-crawler --save

Basic usage

Using async/await & modules

import threddsCrawler from 'thredds-catalog-crawler'

async function crawlThredds() {
    const catalog = await threddsCrawler('http://something/thredds/catalog/my/catalog.xml')
    await catalog.loadAllNestedCatalogs()
    const datasets = catalog.getAllChildDatasets()
}
crawlThredds()

Using traditional promises & modules

const threddsCrawler = require('thredds-catalog-crawler')

threddsCrawler('http://something/thredds/catalog/my/catalog.xml')
.then(function (catalog) {
    catalog.loadAllNestedCatalogs()
})

Dependencies

This package uses the Fetch API. If you're using this library in NodeJS you'll need a fetch polyfill like isomorphic-fetch or if you want to support older browsers we'd suggest unfetch. You may also need a URL API polyfill such as url-polyfill for older browsers.

import 'isomorphic-fetch'
import 'url-polyfill'
import threddsCrawler from 'thredds-catalog-crawler'

API

Catalog

A Catalog represents the root object in a THREDDS heirarchy. Catalogs can contain datasets, as well as references to other catalogs.

Properties

| Property | Type | Description | | ------------- | --------- | ------------- | | url | String | Url of the catalog | | name | String | Name of the catalog | | isLoaded | Boolean | Indicates whether the endpoint has been loaded. If true then datasets and services will be populated, and limited catalog information. If false then most information will be unavailable. | | datasets | Array | An array of datasets found in the catalog | | catalogs | Array | An array of nested catalogs found in the catalog | | services | Object | An object containing the available services for a catalog, organised by service type | | hasDatasets | Boolean | Indicates whether the catalog contains datasets directly | | hasNestedCatalogs | Boolean | Indicates whether the catalog contains nested catalogs | | wmsBase | String | The base url for a WMS service. If no WMS support is available then null | | supportsWms | Boolean | Does a catalog have a WMS service for datasets |

Methods

| Method | Returns | Description | | --------------------- | --------------- | ------------ | | loadAllNestedCatalogs | N/A | Loads all nested catalogs recurrsively | | loadNestedCatalogById(id) | Catalog | Crawls a single nested catalog based on a id string | | getAllChildDatasets | Array[Dataset1, Dataset2...] | Returns a flattened array of datasets from all nested catalogs which have been loaded. |

Dataset

A Dataset can contain datasets, as well as references to other catalogs.

Properties

| Property | Type | Description | | ----------------- | -------------- | ------------- | | id | String | An id of the dataset | | name | String | Name of the dataset | | parent | Object | A catalog or another dataset | | urlPath | String | Partial url path of the dataset | | isParentDataset | Boolean | Indicates whether this dataset contains other datasets | | datasets | Array[Dataset] | An array of nested datasets | | wmsUrl | String | A url for the GetCapabilities endpoint for the dataset. Constructed from the dataset and its parent catalog item | | parentCatalog | Catalog | A reference to the datasets parent catalog | | supportsWms | Boolean | Does this dataset have a WMS available |

Methods

| Method | Returns | Description | | --------------------- | --------------- | ------------ | | loadAllNestedCatalogs | N/A | Loads all nested catalogs recurrsively |