music_metadata.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // const music_metadata = require('music-metadata')
  3. // const util = require('util')
  4. //
  5. // console.log(music_metadata)
  6. //
  7. //
  8. // async function main() {
  9. // try {
  10. // const filePath = 'F:\\Music\\ChiliChill - 时光盲盒.flac';
  11. // console.log('Parsing metadata...')
  12. // const metadata = await music_metadata.loadMusicMetadata(filePath);
  13. //
  14. // // Output the parsed metadata to the console in a readable format
  15. // console.log(util.inspect(metadata, { showHidden: false, depth: null }));
  16. // } catch (error) {
  17. // console.error('Error parsing metadata:', error.message);
  18. // }
  19. // }
  20. // main()
  21. import { parseFile } from 'music-metadata';
  22. import { inspect } from 'util';
  23. (async () => {
  24. try {
  25. const filePath = 'F:\\Music\\ChiliChill - 时光盲盒.flac';
  26. const metadata = await parseFile(filePath);
  27. // Output the parsed metadata to the console in a readable format
  28. console.log(inspect(metadata, { showHidden: false, depth: null }));
  29. } catch (error) {
  30. console.error('Error parsing metadata:', error.message);
  31. }
  32. })();