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() function doesn't exist #2144

Closed
2 tasks done
simonsanchezart opened this issue Jul 12, 2024 · 5 comments
Closed
2 tasks done

parseFile() function doesn't exist #2144

simonsanchezart opened this issue Jul 12, 2024 · 5 comments
Labels
cannot reproduce The issue described cannot be reproduced question Question, clarification, discussion

Comments

@simonsanchezart
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

music-metadata version

9.0.1

JavaScript module eco system

ECMAScript modules (ESM), music-medata ≥ version 8

Current Behavior

I'm using Tauri + React (ts).
I've installed the module, when I try to import the parseFile() function I get the error:
Module '"music-metadata"' has no exported member 'parseFile'.ts(2305)
There is also no parseFile() defined in core.d.ts

I'm importing it like this:
import { parseFile } from "music-metadata";
"type": "module", in package.json

Expected Behavior

I could import parseFile() by doing import { parseFile } from "music-metadata"; and then use parseFile()

Attached audio sample?

  • I have provided sufficient information to reproduce the issue
@simonsanchezart simonsanchezart added the bug Bug, will addressed with high priority label Jul 12, 2024
@Borewit
Copy link
Owner

Borewit commented Jul 12, 2024

As written in the README, parseFile() is exclusively available for Node.js engines. So for sure this not available in React running in your browser.
Which would be pointless as you do not have access to your file system in the browser.

For parsing a File in your browser, you can use the parseBlob().

I have 0 experience with Tauri + React. If Tauri covers the backend, using some kind of Node.js engine, Tauri should be able to give you access to Node.js specific functions. If it does not, you need to raise your issue there.

@Borewit Borewit added the question Question, clarification, discussion label Jul 12, 2024
@joacoespinosa
Copy link

joacoespinosa commented Jul 12, 2024

Hi @Borewit. I'm facing the exact same problem after updating from 7.14.0 to @latest

Mine is a Node.js app which was working with the mentioned version but breaks with 9.0.1: Module '"music-metadata"' has no exported member 'parseFile'

Thoughts?

@Borewit
Copy link
Owner

Borewit commented Jul 13, 2024

Hi @Borewit. I'm facing the exact same problem after updating from 7.14.0 to @latest

Mine is a Node.js app which was working with the mentioned version but breaks with 9.0.1: Module '"music-metadata"' has no exported member 'parseFile'

Thoughts?

Hello @joacoespinosa, @latest is a moving target, I assume this is v9.0.1

I cannot reproduce your problem, I can only proof parseFile() is accessible in a Node.js engine:

image

Reference: https://onecompiler.com/nodejs/42jznqj9u

@Borewit Borewit added cannot reproduce The issue described cannot be reproduced and removed bug Bug, will addressed with high priority labels Jul 13, 2024
@joacoespinosa
Copy link

This is what I observe when using 7.14.0:
image

And this is what I see as soon as I update the library:
image

I have just realized that the problem occurs even after updating to 8.2.0. Therefore, the issue I'm facing is not strictly related to v9.0.1

I'll keep digging, thanks.

@Borewit
Copy link
Owner

Borewit commented Jul 17, 2024

music-metadata version 8 & 9 are Pure ESM packages, while version 7 is CommonJS.

To be able to use music-metadata version 8 or 9:

  1. Run from an ESM based project (include "type": "module" in package.json)

To be able to import parseFile() :

  1. Use Node.js

@Borewit Borewit closed this as completed Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cannot reproduce The issue described cannot be reproduced question Question, clarification, discussion
Projects
None yet
Development

No branches or pull requests

3 participants