Socket
Socket
Sign inDemoInstall

crawl-sitemap

Package Overview
Dependencies
10
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    crawl-sitemap

Crawl to discover all URL locations defined in a sitemap or sitemap index


Version published
Weekly downloads
157
increased by8.28%
Maintainers
1
Install size
259 kB
Created
Weekly downloads
 

Changelog

Source

1.0.1

Bug Fixes

  • Improve error message thrown when attempting to crawl missing sitemap (404).

Readme

Source

crawl-sitemap

Crawl to discover all URL locations defined in a sitemap or sitemap index.

Example

import crawl from 'crawl-sitemap';

for await (const url of crawl('https://andrewduthie.com/sitemap.xml')) {
	console.log(url);
}

// → https://andrewduthie.com/2019/11/29/back-to-basics-a-possible-future-without-javascript-build-tools/
// → https://andrewduthie.com/2020/03/15/typescript-types-for-productivity/
// → https://andrewduthie.com/2019/12/22/font-loading-performance-for-single-page-applications/
// ...

Installation

crawl-sitemap is authored as an ESM module, and therefore requires Node 12.0 or newer.

Install using NPM or Yarn:

npm install crawl-sitemap
yarn add crawl-sitemap

Usage

The default export will return an async generator when called, which can be iterated asynchronously with for await to operate on crawled links as soon as they're discovered:

for await (const url of crawl('https://andrewduthie.com/sitemap.xml')) {
	console.log(url);
}

API

function crawl(url: string): AsyncGenerator<string>;

License

Copyright 2020 Andrew Duthie

Released under the MIT License. See LICENSE.md.

FAQs

Last updated on 24 Oct 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc