Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parseFile not working with Bun runtime #2236

Closed
2 tasks done
DavNej opened this issue Sep 2, 2024 · 2 comments
Closed
2 tasks done

parseFile not working with Bun runtime #2236

DavNej opened this issue Sep 2, 2024 · 2 comments
Labels
bug Bug, will addressed with high priority

Comments

@DavNej
Copy link

DavNej commented Sep 2, 2024

Is there an existing issue for this?

  • I have searched the existing issues

music-metadata version

10.3.1

Current Behavior

Using Bun as runtime, the console remains idle when parseFile is called.

Here is the following code. This code works well with npm and tsx.

Also, on line 1, I get the following error from typescript:
Module '"music-metadata"' has no exported member 'parseFile'

import { parseFile } from 'music-metadata'
import { inspect } from 'util'

const filePath = '/path/to/file.mp3'

async function main() {
  try {
    const metadata = await parseFile(filePath)

    console.log(inspect(metadata, { showHidden: false, depth: null }))
  } catch (error) {
    console.error('Error parsing metadata:', error.message)
  }
}

await main()

Expected Behavior

Should read properly the metadata of the given file

Attached audio sample?

  • I have provided sufficient information to reproduce the issue
@DavNej DavNej added the bug Bug, will addressed with high priority label Sep 2, 2024
@minht11
Copy link

minht11 commented Sep 2, 2024

Bun explicitly has a policy if it works in Node but not in Bun, it is a Bun bug, you should report it there.

@vdawg-git
Copy link

This works:

Bun.file(filePath)
    .arrayBuffer()
    .then((buffer) => new Uint8Array(buffer))
    .then((buffer) =>
	parseBuffer(buffer, { path: filePath }, { duration: true })
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, will addressed with high priority
Projects
None yet
Development

No branches or pull requests

4 participants