Borewit / music-metadata-browser

Browser version of music-metadata parser Supporting a wide range of audio and tag formats.
MIT License
239 stars 21 forks source link

fetchFromUrl doesn't include credentials #835

Closed gertjanal closed 2 years ago

gertjanal commented 2 years ago

The function export async function fetchFromUrl(audioTrackUrl: string, options?: IOptions): Promise<IAudioMetadata> {

Does a fetch without including the credentials or cors mode. When enabled, I can use it to fetch data from an url that needs a web session (login) to download the data.

I think it should be as simple as

await fetch(audioTrackUrl, {
    credentials: 'include',
    mode: 'cors'
})
Borewit commented 2 years ago

There are so many HTTP options, I cannot consider support those. There are plenty of smart HTTP clients which you use do the authentication. Pick one which suits your needs and pass the stream or buffer to music-metadata-browser.