[go: up one dir, main page]

album-image

1.1.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i album-image

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

12.4 kB

Total Files

9

Last publish

Collaborators

  • 0x0f