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 0.8.0 to 0.9.0

8

dist/fetch/Browser2NodeStream.d.ts

@@ -12,6 +12,14 @@ /// <reference types="node" />

bytesRead: number;
/**
* Browser stream
*/
private reader;
private pendingRead;
constructor(stream: ReadableStream);
_read(): void;
_destroy(error: Error | null, callback: (error: Error | null) => void): void;
/**
* Wait for read to complete and release ReadableStreamReader
*/
release(): Promise<void>;
}

29

dist/fetch/Browser2NodeStream.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const initDebug = require("debug");
const debug = initDebug('music-metadata-browser:stream');
/**

@@ -18,3 +28,5 @@ * A mock readable-stream, using string to read from

_read() {
this.reader.read().then(res => {
this.pendingRead = this.reader.read();
this.pendingRead.then(res => {
delete this.pendingRead;
if (res.done) {

@@ -30,3 +42,4 @@ this.push(null);

_destroy(error, callback) {
this.reader.cancel().then(() => {
this.release().then(() => {
debug(`release browser stream.`);
callback(null);

@@ -37,3 +50,15 @@ }).catch(err => {

}
/**
* Wait for read to complete and release ReadableStreamReader
*/
release() {
return __awaiter(this, void 0, void 0, function* () {
debug(`Release stream...`);
if (this.pendingRead) {
yield this.pendingRead;
this.reader.releaseLock();
}
});
}
}
exports.Browser2NodeStream = Browser2NodeStream;

31

dist/index.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -24,5 +32,7 @@ const initDebug = require("debug");

function parseReadableStream(stream, contentType, options) {
const ns = new Browser2NodeStream_1.Browser2NodeStream(stream);
return exports.parseNodeStream(ns, contentType, options).then(res => {
debug(`Completed parsing from stream 1bytesRead=${ns.bytesRead} / fileSize=${options && options.fileSize ? options.fileSize : '?'}`);
return __awaiter(this, void 0, void 0, function* () {
const ns = new Browser2NodeStream_1.Browser2NodeStream(stream);
const res = yield exports.parseNodeStream(ns, contentType, options);
debug(`Completed parsing from stream bytesRead=${ns.bytesRead} / fileSize=${options && options.fileSize ? options.fileSize : '?'}`);
yield ns.release();
return res;

@@ -60,3 +70,4 @@ });

function fetchFromUrl(audioTrackUrl, options) {
return fetch(audioTrackUrl).then(response => {
return __awaiter(this, void 0, void 0, function* () {
const response = yield fetch(audioTrackUrl);
const contentType = response.headers.get('Content-Type');

@@ -69,12 +80,10 @@ const headers = [];

if (response.body) {
return this.parseReadableStream(response.body, contentType, options).then(res => {
response.body.cancel();
return res;
});
const res = yield this.parseReadableStream(response.body, contentType, options);
if (!response.body.locked)
yield response.body.cancel();
return res;
}
else {
// Fall back on Blob
return response.blob().then(blob => {
return this.parseBlob(blob, options);
});
return this.parseBlob(yield response.blob(), options);
}

@@ -81,0 +90,0 @@ }

{
"name": "music-metadata-browser",
"version": "0.8.0",
"version": "0.9.0",
"description": "Browserifed version of music-metadata",

@@ -41,3 +41,11 @@ "main": "dist/index.js",

"WavPack",
"Opus"
"Opus",
"speex",
"musepack",
"mpc",
"dsd",
"dsf",
"mpc",
"dff",
"dsdiff"
],

@@ -94,3 +102,3 @@ "license": "MIT",

"debug": "^4.0.1",
"music-metadata": "^3.6.1",
"music-metadata": "^3.7.0",
"readable-stream": "^3.3.0",

@@ -97,0 +105,0 @@ "remove": "^0.1.5",

Sorry, the diff of this file is not supported yet

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