album-image
v1.1.0
Published
Retrieve album cover art
Downloads
102
Readme
album-image
Look up images from the Musicbrainz/Cover Art Archive via CLI.
Requirements
- Node 18+ (uses native
fetch
)
Usage
CLI
By album name alone
npx album-image drukqs
By artist and album name
npx album-image Prodigy "the fat of the land"
API
npm install album-image
By album name alone
import { getAlbumImage } from 'album-image'
const url = await getAlbumImage({ album: 'drukqs' })
By artist and album name
import { getAlbumImage } from 'album-image'
const url = await getAlbumImage({ artist: 'Prodigy', album: 'the fat of the land' })
Aborting Requests
Requests can be aborted prematurely by using an AbortController:
import { getAlbumImage } from 'album-image'
const ab = new AbortController()
async function run() {
try {
const url = await getAlbumImage({ artist: 'Green Day', album: 'Dookie', signal: ab.signal })
} catch (err) {
// will fail with "AbortError: This operation was aborted"
console.error(err)
}
}
run()
ab.abort()
License
MIT