I used realtime-bpm-analyzer with web-audio-api and had to patch the AudioWorklet.#readModule (in src/AudioWorklet.js) method to support blob: urls
it was a simple change:
return meta.includes('base64') ? atob(body) : decodeURIComponent(body)
}
+ if (url.startsWith('blob:')) {
+ return await fetch(url).then(res => res.text())
+ }
+
// Dynamic import fs/path — works in Node.js, throws in browser
let fs, path
try { fs = await import('fs'); path = await import('path') } catch {
I tested it with Bun v1.3.5
I used
realtime-bpm-analyzerwithweb-audio-apiand had to patch theAudioWorklet.#readModule(insrc/AudioWorklet.js) method to supportblob:urlsit was a simple change:
return meta.includes('base64') ? atob(body) : decodeURIComponent(body) } + if (url.startsWith('blob:')) { + return await fetch(url).then(res => res.text()) + } + // Dynamic import fs/path — works in Node.js, throws in browser let fs, path try { fs = await import('fs'); path = await import('path') } catch {I tested it with Bun v1.3.5