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

oositemap

v1.0.2

Published

<br>

Downloads

3

Readme

Object-Oriented SiteMap

BY: DerpDevs

What is this?

This is a project made by DerpDevs, we were working on some stuff and realized that we were going to need a web scraper/sitemap creator. There were current options, but none of them fullfilled the Object-Oriented style we preferred, we decided to go aside and create an Object-Oriented SiteMap Generator.

This uses an intersting method of progress due to our knowledge limits.

Functioning Method

The way this works is:

  • It scrapes the website
  • It is a live generator with a "done" event for when the scraper is done and an "add" event for every url it scrapes.
  • It's formatted like this:

URL: "https://example.com"

{
	aPath: {
		'/':'https://example.com/aPath'
		subPath: {
			'/':'https://example.com/aPath/subPath'
		}
	},
	otherPath: {
		'/':'https://example.com/otherPath'
	} 
}

and it continues like that.

Create SiteMap

This is how you create a sitemap:

(Options Are Showed In This README, excluding the filePath option)

const SiteMapGenerator = require('oositemap')

var SiteMap = new SiteMapGenerator('https://example.com', options)


// Every time a URL is scraped
SiteMap.on('add', (url) => {console.log(`SCRAPED:  ${url}`)})

// When it's done scraping
SiteMap.on('done', (generated) => {console.log(generated)})

// If it errors
SiteMap.on('error', (err) => (console.error(err)))

// Every time something gets ignored due to the "ignore" option
SiteMap.on('ignore', (url) => {console.log(`IGNORED: ${url}`)})


SiteMap.start()

Functions

start

SiteMap.start()

Start the scraper.

stop

SiteMap.stop()

End the scraper (runs the done event).

(Takes at least 2500ms before it calls the event, just to make sure it's done scraping.)

on

SiteMap.on(/* Event */,/* Function */)

Registers a handler for an event (one per event).

Events

add

SiteMap.on('add', (url) => {/* Code Here */})

Every time a URL is scraped.

done

SiteMap.on('done', (generated) => {/* Code Here */})

When it's done scraping.

error

SiteMap.on('error', (error) => {/* Code Here */})

If it errors.

ignore

SiteMap.on('ignore', (url) => {/* Code Here */})

Every time something gets ignored due to the "ignore" option.

We hope this helped!