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

hypem-stream

v1.0.1

Published

Search and stream music from Hype Machine!

Downloads

6

Readme

hypem-stream

Search and stream music from Hype Machine! Provides a simple, node-friendly interface to access Hype Machine's search, art and music download streams. All of the streams are lazy so feel free to store as many references as you please. hypem also supports the command-line. See the CLI section for more details.

Installation

For the module:

$ npm install hypem-stream

For the CLI program:

$ npm install -g hypem-stream

Examples

var fs = require('fs');
var hypem = require('hypem-stream');

hypem.search('allah las catamaran', function (err, tracks) {
    var track;

    if (err) {
        return console.error(err);
    }

    track = tracks[0];

    track.art.pipe(fs.createWriteStream('album.jpg'));
    track.song.pipe(fs.createWriteStream('catamaran.mp3'));
});

API

Any stream refered to as "lazy" is a reference to lazystream. This means that you can accumulate as many as you want in memory without committing to downloading each, yet still treat them like vanilla readable streams.

track

{
    title, artist, duration,
    art: { large, medium, small },
    song
}

art is an object containing references to three lazy, readable streams. Each reference a JPEG image download, usually of the album art. art itself is also a readable stream which returns the largest image.

song is a lazy reference to the readable download stream.

hypem.song(entry, [options])

Return a readable stream of a song (almost always MP3).

entry is expected to be an object with title and artist, or a string containing a hypem identifier.

options is an optional object that is passed into the needle requests required. This is provided to allow one to set custom timeouts or user agents.

hypem.search(entry, [options], callback)

Search for tracks on the hypem website.

entry is expected to be either a string or an object. If it's a string, then it's considered to be entry.terms and the other fields are defaulted.

entry.terms is a string containing the search criteria you wish to perform. Usually a song title or artist name.

entry.sort is an optional string that should be "favorite", "blogged" or "new". By default, entry.sort is set to "favorite".

entry.page is an optional integer describing which page to begin scraping at. By default it's set to 1.

options is an optional object with the same criteria as hypem.song's options.

callback returns an array of tracks.

CLI

Usage: hypem [<terms>] [options]
        <terms> being search criteria (an artist or song, for example).

        -h, --help              Display this screen.

        -l, --list [<p>]        Search for tracks based on input terms. <p> is an
                                optional integer describing which page to view.
        -i, --id <id>           Request a single track based on ID.

        -a, --art [<size>]      Grab the artwork stream instead of the
                                MP3 stream. Size can be "small", "medium" or "large".

        -o, --out <file>        Stream to download into a file. When
                                unspecified, dumps to STDOUT.

Examples

$ hypem catamaran | mplayer -cache 4096 -
$ hypem catamaran --art medium > album.jpeg
$ hypem the\ beatles --list 1

License

MIT