music-metadata
Advanced tools
Comparing version 10.8.3 to 10.9.0
@@ -13,3 +13,9 @@ import type { IGetToken, ITokenizer } from 'strtok3'; | ||
captureStackTrace(targetObject: object, constructorOpt?: Function): void; | ||
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; | ||
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite /** | ||
* Specifies the amount of time to buffer data before starting to play the file, in millisecond units. | ||
* If this value is nonzero, the Play Duration field and all of the payload Presentation Time fields have been offset | ||
* by this amount. Therefore, player software must subtract the value in the preroll field from the play duration and | ||
* presentation times to calculate their actual values. It follows that all payload Presentation Time fields need to | ||
* be at least this value. | ||
*/[]) => any) | undefined; | ||
stackTraceLimit: number; | ||
@@ -16,0 +22,0 @@ }; |
@@ -0,0 +0,0 @@ The MIT License (MIT) |
{ | ||
"name": "music-metadata", | ||
"description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.", | ||
"version": "10.8.3", | ||
"version": "10.9.0", | ||
"author": { | ||
@@ -24,2 +24,3 @@ "name": "Borewit", | ||
"import": "./lib/index.js", | ||
"module-sync": "./lib/index.js", | ||
"require": "./lib/node.cjs", | ||
@@ -30,2 +31,3 @@ "types": "./lib/index.d.ts" | ||
"import": "./lib/core.js", | ||
"module-sync": "./lib/index.js", | ||
"require": "./lib/default.cjs", | ||
@@ -32,0 +34,0 @@ "types": "./lib/core.d.ts" |
@@ -774,13 +774,26 @@ [![Node.js CI](https://github.com/Borewit/music-metadata/actions/workflows/nodejs-ci.yml/badge.svg?branch=master)](https://github.com/Borewit/music-metadata/actions?query=branch%3Amaster) | ||
For legacy CommonJS projects needing to load the `music-metadata` ESM module, you can use the `loadMusicMetadata` function: | ||
Using Node.js ≥ 22, which is support loading ESM module via require | ||
```js | ||
const { loadMusicMetadata } = require('music-metadata'); | ||
const mm = require('music-metadata'); | ||
``` | ||
For older Node.js version < 22, you need to dynamically import **music-metadata**: | ||
```js | ||
(async () => { | ||
// Dynamically loads the ESM module in a CommonJS project | ||
const mm = await loadMusicMetadata(); | ||
const mm = await import('music-metadata'); | ||
})(); | ||
``` | ||
const metadata = await mm.parseFile('/path/to/your/file'); | ||
For CommonJS TypeScript projects, using a Node.js version < 22, you can use [load-esm](https://github.com/Borewit/load-esm): | ||
This method shall replace the embedded CJS loader `loadMusicMetadata()` function. | ||
```js | ||
import {loadEsm} from 'load-esm'; | ||
(async () => { | ||
// Dynamically loads the ESM module in a CommonJS project | ||
const mm = await loadEsm<typeof import('music-metadata')>('music-metadata'); | ||
})(); | ||
``` | ||
@@ -787,0 +800,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
516725
12170
860