A decentralized music tracking and discovery platform built on AT Protocol 馃幍 rocksky.app
spotify atproto lastfm musicbrainz scrobbling listenbrainz
at main 19 lines 452 B view raw
1import axios from "axios"; 2 3export async function getContentType(url: string): Promise<string | null> { 4 const response = await axios.head(url); 5 return response.headers["content-type"] || null; 6} 7 8export default async function downloadImage( 9 url?: string | null, 10): Promise<Buffer | null> { 11 if (!url) { 12 return null; 13 } 14 15 const response = await axios.get(url, { 16 responseType: "arraybuffer", 17 }); 18 return Buffer.from(response.data); 19}