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 🙏

© 2025 – Pkg Stats / Ryan Hefner

salticidae

v0.10.0

Published

A utility library to make downloading & extracting specific content from a URL easy

Downloads

69

Readme

Salticidae

Requires Node v8.2.1 or greater.

The jumping spider family (Salticidae) contains over 500 described genera and more than 5800 described species, making it the largest family of spiders with about 13% of all species. Jumping spiders have some of the best vision among arthropods and use it in courtship, hunting, and navigation. Although they normally move unobtrusively and fairly slowly, most species are capable of very agile jumps, notably when hunting, but sometimes in response to sudden threats or crossing long gaps. ~ from Wikipedia

This is a set of utilities to simplify common local scripting tasks. As the library originated as a utility for spidering specific content from a webpage, it is named after the jumping spider family — because spiders are terrifying, doubly so if they can attack at range.

Build Status

Modules

spider

Given a URL, download the URL's HTML and return an object of data extracted from the page content using a series of Cheerio selectors.

Please Note: The spider module has a peer dependency on axios.

Run npm install --save axios to add this dependency to your project before you utilize this module.

const spider = require( 'salticidae/spider' );
// Alternately: `const { spider } = require( 'salticidae' );`

spider( 'http://some.url/', {
	key: $ => $( '.some-selector' ).find( '.to #return' ).text(),
	otherKey: $ => $( '.another-selector' ).html(),
}).then( results => {
	console.log(results);
	// {
	//     key: 'Whatever the text of that node was',
	//     otherKey: '<p>The innerHTML of that other node</p>',
	// }
});

parse

Works just like spider, but accepts HTML as string content instead of a remote URL.

const parse = require( 'salticidae/parse' );

parse( `
<p>Some sort of text<sup>*</sup>, <em>etcetera</em>.</p>
<p><em>Declarative</em> final statement!</p>
`, {
	emphasizedText: $ => $( 'em' ).text(),
	lastParagraph: $ => $( 'p' ).last().html(),
} );
// {
//   emphasizedText: 'etcetera',
//   lastParagraph:  '<em>Declarative</em> final statement!',
// }

cp

exec( commandString ).then( () => 'done' );

Execute an arbitrary shell command string as a child process.

spawn( command, argsArray ).then( () => 'done' );

Spawn a shell command as a child process and pass in provided arguments. The spawned process inherits the active stdio streams.

fs

download( absFilePath, uri ).then( () => 'done' );

Download the contents of uri and save them as absFilePath.

ensureExists( absFolderPath ).then( () => 'exists' );

Ensure a folder path exists on disk using mkdirp.

fileExists( absFilePath ).then( exists => {} );

Check whether a given file exists on disk.

ls( absFolderPath, [options] ).then( files => {} );

Enumerate the files within the specified directory. If { absolute: true } is passed in the options object, the promise will resolve to absolute file system paths.

readFile( absFilePath ).then( fileContents => {} );

Read a file on disk and return its contents as a string.

readJSON( absFilePath ).then( data => {} );

Read a file on disk and parse its contents as JSON. (Note that it is usually preferable to use require to read JSON files.)

writeFile( absFilePath, contents ).then( () => 'done' );

Write string content to a file on disk.

writeJSON( absFilePath, data ).then( () => 'done' );

Serialize a JS object to a file on disk as stringified JSON.

sequence

runInSequence( fns, [progressBar] ).then( () => 'done' );

Given an array of functions creating Promises, execute those functions one at a time and return a Promise that resolves when all functions have run. If a progress ProgressBar instance is provided as a second argument, .tick() will be called on that bar each time a function completes.

runInBatches( fns, batchSize, [progressBar] ).then( () => 'done' );

Given an array of functions creating Promises, execute them in parallel batches of a specific size and return a Promise that resolves when all batches have run.

util

pad( 42, 4 ); // 0042

Pad a numeric string with leading zeroes until the string is a certain length.

const arr = [ 1, 2, 3, 4, 5, 6, 7, 8 ];
chunk( array, 4 );
// [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8 ] ]

Break an array into smaller arrays of a specific maximum length.

Promise.resolve( input )
	.then( wait( 200 ) )
	.then( output => {
		// Approximately 200ms have passed.
		input === output
	} );

Return a function that waits for approximately the provided number of milliseconds (+/- 20%), then returns a promise resolving to the function's input.