Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

music-metadata-browser

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

music-metadata-browser - npm Package Compare versions

Comparing version 2.5.0 to 2.5.1

33

lib/index.js

@@ -31,3 +31,3 @@ "use strict";

const ns = new readable_web_to_node_stream_1.ReadableWebToNodeStream(stream);
const res = await exports.parseNodeStream(ns, typeof fileInfo === 'string' ? { mimeType: fileInfo } : fileInfo, options);
const res = await (0, exports.parseNodeStream)(ns, typeof fileInfo === 'string' ? { mimeType: fileInfo } : fileInfo, options);
await ns.close();

@@ -48,6 +48,35 @@ return res;

}
return parseReadableStream(blob.stream(), { mimeType: blob.type, size: blob.size }, options);
const stream = blob.stream ? blob.stream() : convertBlobToReadableStream(blob);
return parseReadableStream(stream, { mimeType: blob.type, size: blob.size }, options);
}
exports.parseBlob = parseBlob;
/**
* Convert Blob to ReadableStream
* Fallback for Safari versions < 14.1
* @param blob
*/
function convertBlobToReadableStream(blob) {
const fileReader = new FileReader();
return new ReadableStream({
start(controller) {
// The following function handles each data chunk
fileReader.onloadend = event => {
let data = event.target.result;
if (data instanceof ArrayBuffer) {
data = new Uint8Array(data);
}
controller.enqueue(data);
controller.close();
};
fileReader.onerror = error => {
controller.close();
};
fileReader.onabort = error => {
controller.close();
};
fileReader.readAsArrayBuffer(blob);
}
});
}
/**
* Parse fetched file, using the Web Fetch API

@@ -54,0 +83,0 @@ * @param audioTrackUrl - URL to download the audio track from

@@ -47,2 +47,10 @@ "use strict";

{
methodDescription: 'parseBlob() without blob.stream being implemented',
parseUrl: async (audioTrackUrl, options) => {
const blob = await getAsBlob(audioTrackUrl);
blob.stream = undefined; // Simulate `stream()` not being implemented by browser (e.g. Safari < 14.1)
return mm.parseBlob(blob, options);
}
},
{
methodDescription: 'fetchFromUrl()',

@@ -49,0 +57,0 @@ parseUrl: (audioTrackUrl, options) => {

24

package.json
{
"name": "music-metadata-browser",
"version": "2.5.0",
"version": "2.5.1",
"description": "Browserifed version of music-metadata",

@@ -87,14 +87,14 @@ "main": "lib/index.js",

"@tokenizer/token": "^0.3.0",
"@types/jasmine": "^3.8.1",
"@types/jasmine": "^3.10.3",
"@types/node": "^16.4.1",
"coveralls": "^3.1.1",
"del-cli": "^4.0.1",
"eslint": "^7.32.0",
"eslint": "^8.6.0",
"filereader-stream": "^2.0.0",
"istanbul-instrumenter-loader": "^3.0.1",
"jasmine-core": "^3.8.0",
"karma": "^6.3.4",
"jasmine-core": "^4.0.0",
"karma": "^6.3.11",
"karma-chrome-launcher": "^3.0.0",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-firefox-launcher": "^2.1.1",
"karma-firefox-launcher": "^2.1.2",
"karma-jasmine": "^4.0.1",

@@ -106,13 +106,13 @@ "karma-jasmine-html-reporter": "^1.7.0",

"stream-http": "^3.2.0",
"ts-loader": "^9.2.5",
"ts-loader": "^9.2.6",
"tslint": "^6.1.3",
"typescript": "^4.3.5",
"typescript": "^4.5.4",
"url": "^0.11.0",
"webpack": "^5.48.0",
"webpack-cli": "^4.7.2"
"webpack": "^5.66.0",
"webpack-cli": "^4.9.1"
},
"dependencies": {
"buffer": "^6.0.3",
"debug": "^4.3.2",
"music-metadata": "^7.11.3",
"debug": "^4.3.3",
"music-metadata": "^7.11.6",
"readable-stream": "^3.6.0",

@@ -119,0 +119,0 @@ "readable-web-to-node-stream": "^3.0.2"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc