Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

album-art

2.0.1 • Public • Published

album-art

npm version Build Status Dependency Status Maintainability Try movie-art on RunKit

Fetch an album or artist image url: "The Beatles" ➔ http://path/to/beatles.jpg

album-art

Try it on RunKit (Output)

Features

  • Use anywhere, browser or Node - UMD (Browser Support)
  • Promise and Callback API
  • Fetch images for albums or artists
  • Multiple size options
  • Uses Last.FM data

Install

Using NPM:

$ npm install -g album-art

In the browser:

<!-- albumArt window global -->
<script type="text/javascript" src="https://unpkg.com/album-art"></script>

(via Unpkg, or via JSDelivr)

Usage

const albumArt = require( 'album-art' )
 
albumArt( 'Rush' ).then( console.log )
//=> http://path/to/rush.jpg
Callback
albumArt( 'Rush', ( error, response ) => {
   console.log( response )
 
   //=> http://path/to/rush.jpg
})
Usage with album and size options
albumArt( 'Rush', {album: '2112', size: 'small'} )
  .then( console.log )
 
//=> http://path/to/rush_2112_small.jpg

API

albumArt(artist [, options] [, callback])

Accepts an artist string to search for. Returns a Promise which resolves to a string URL.

artist

Required
Type: string

Artist to search for.

callback(error, response)

Function to be called on complete or on error.

Options

A JavaScript object with the following properties:

album

Type: string

Album to search for.

size

Type: string

Requested image size. possible values: small, medium, large, extralarge, mega

CLI Usage

You can also run as a CLI app by installing it globally:

$ npm install --global album-art
 
$ album-art --help
 
Usage
  $ album-art artist [album] [size]
 
Example
  $ album-art 'The Beatles' --album 'Abbey Road' --size 'large'
  http://path/to/beatles/abbey_road_large.jpg

Related

License

This package uses the Last.fm API for it's data. You may consult the Last.fm API Terms of Service for license details.

MIT © Lacy Morrow

install

npm i album-art

Downloadsweekly downloads

21

version

2.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability