Getting started
Installation
Depending on your choice regarding the package manager, you can run one of the following commands to install simple-fm:
# Install simple-fm via npm
npm i @solely/simple-fm
# Install simple-fm via pnpm
pnpm add @solely/simple-fm
# Install simple-fm via yarn
yarn add @solely/simple-fm
Usage
You’ll need to import the package first.
// Import simple-fm using CommonJS
const SimpleFM = require('@solely/simple-fm');
// Import simple-fm using ESM
import SimpleFM from '@solely/simple-fm';
// Import simple-fm using Deno
import SimpleFM from 'https://esm.sh/@solely/simple-fm';
Below is an example code to quickly fetch recent tracks from a user:
const client = new SimpleFM('Your Last.fm API token goes here');
const data = await client.user.getRecentTracks({ username: 'solelychloe' });
console.log(data);
More examples coming soon!