music-metadata-browser
Advanced tools
Comparing version 1.3.0 to 1.4.0
{ | ||
"name": "music-metadata-browser", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Browserifed version of music-metadata", | ||
@@ -78,3 +78,3 @@ "main": "dist/index.js", | ||
"coveralls": "^3.0.3", | ||
"del-cli": "^2.0.0", | ||
"del-cli": "^3.0.0", | ||
"eslint": "^6.2.2", | ||
@@ -103,3 +103,3 @@ "filereader-stream": "^2.0.0", | ||
"debug": "^4.0.1", | ||
"music-metadata": "^4.4.0", | ||
"music-metadata": "^4.6.0", | ||
"readable-stream": "^3.3.0", | ||
@@ -106,0 +106,0 @@ "readable-web-to-node-stream": "^1.1.4", |
@@ -76,12 +76,17 @@ [![Build Status](https://travis-ci.org/Borewit/music-metadata-browser.svg?branch=master)](https://travis-ci.org/Borewit/music-metadata-browser) | ||
### Requirements | ||
[music-metadata-browser](https://www.npmjs.com/package/music-metadata-browser) is a module designed for a module bundler like [webpack](https://webpack.js.org/). | ||
A *module bundler* turns modules in static assets (typically one minified JavaScript file). | ||
Those *static assets* are then prepared, made compatible and optimized for execution by a web browser. | ||
### Import music-metadata | ||
Import music-metadata in JavaScript | ||
```JavaScript | ||
const mm = require('music-metadata-browser'); | ||
```js | ||
const musicMetadata = require('music-metadata-browser'); | ||
``` | ||
This is how it's done in TypeScript | ||
```TypeScript | ||
import * as mm from 'music-metadata-browser'; | ||
This is how it's done in [TypeScript](https://www.typescriptlang.org/docs/home.html) | ||
```ts | ||
import * as musicMetadata from 'music-metadata-browser'; | ||
``` | ||
@@ -103,3 +108,3 @@ | ||
```javascript | ||
import * as mm from 'music-metadata-browser'; | ||
const musicMetadata = request('music-metadata-browser'); | ||
@@ -109,11 +114,22 @@ /** | ||
*/ | ||
function readFromBlob(blob) { | ||
async function readFromBlob(blob) { | ||
// blob is a Web API Blob or File | ||
mm.parseBlob(blob).then(metadata => { | ||
musicMetadata.parseBlob(blob).then(musicMetadata => { | ||
// metadata has all the metadata found in the blob or file | ||
}); | ||
}) | ||
} | ||
``` | ||
Or with async/await if you prefer: | ||
```javascript | ||
async function readFromBlob(blob) { | ||
// blob is a Web API Blob or File | ||
const metadata = await musicMetadata.parseBlob(blob); | ||
// metadata has all the metadata found in the blob or file | ||
} | ||
``` | ||
#### parseReadableStream function | ||
@@ -120,0 +136,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
275
28308
6
193
Updatedmusic-metadata@^4.6.0