Look up images from the Musicbrainz/Cover Art Archive via CLI.
- Node 18+ (uses native
fetch
)
npx album-image drukqs
npx album-image Prodigy "the fat of the land"
npm install album-image
import { getAlbumImage } from 'album-image'
const url = await getAlbumImage({ album: 'drukqs' })
import { getAlbumImage } from 'album-image'
const url = await getAlbumImage({ artist: 'Prodigy', album: 'the fat of the land' })
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()
MIT