mirror of
https://codeberg.org/lucida/lucida.git
synced 2026-11-17 00:57:25 -05:00
drop node-fetch dependency, use undici
undici's fetch implementation is included in node and has been considered stable since version 21. for some time I think depending on the undici package instead of the built-in is a good idea so that older nodejs versions will still work correctly.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import crypto from 'crypto'
|
||||
import fetch from 'node-fetch'
|
||||
import { fetch } from 'undici'
|
||||
import {
|
||||
ItemType,
|
||||
StreamerWithLogin,
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
} from '../../types.js'
|
||||
import { DEFAULT_HEADERS } from './constants.js'
|
||||
import { parseAlbum, parseTrack, parseArtist, RawAlbum, RawArtist, RawTrack } from './parse.js'
|
||||
import { Readable } from 'stream'
|
||||
|
||||
function headers(token?: string): HeadersInit {
|
||||
const headers: HeadersInit = DEFAULT_HEADERS
|
||||
@@ -182,7 +183,7 @@ export default class Qobuz implements StreamerWithLogin {
|
||||
return {
|
||||
mimeType: trackFileResponse.mime_type,
|
||||
sizeBytes: parseInt(<string>streamResponse.headers.get('Content-Length')),
|
||||
stream: <NodeJS.ReadableStream>streamResponse.body
|
||||
stream: Readable.fromWeb(streamResponse.body!)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user