Skip to content

Commit

Permalink
Move Web-API readable-stream to Node.js readable-stream to readable-w…
Browse files Browse the repository at this point in the history
…eb-to-node-stream.
  • Loading branch information
Borewit committed May 4, 2019
1 parent 1ae6326 commit b1d80ff
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -77,7 +77,7 @@ yarn add music-metadata-browser

Import music-metadata in JavaScript:
```JavaScript
var mm = require('music-metadata-browser');
const mm = require('music-metadata-browser');
```

This is how it's done in TypeScript:
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -100,6 +100,7 @@
"debug": "^4.0.1",
"music-metadata": "^3.7.0",
"readable-stream": "^3.3.0",
"readable-web-to-node-stream": "^1.0.0",
"remove": "^0.1.5",
"typedarray-to-buffer": "^3.1.5"
}
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Expand Up @@ -2,8 +2,8 @@ import { Buffer } from 'buffer';
import * as initDebug from 'debug';
import * as mm from 'music-metadata/lib/core';
import * as Type from 'music-metadata/lib/type';
import { ReadableWeToNodeStream } from 'readable-web-to-node-stream';
import * as toBuffer from 'typedarray-to-buffer';
import { Browser2NodeStream } from './fetch/Browser2NodeStream';

const debug = initDebug('music-metadata-browser:main');

Expand All @@ -29,7 +29,7 @@ export const parseNodeStream = mm.parseStream;
* @returns {Promise<IAudioMetadata>}
*/
export async function parseReadableStream(stream: ReadableStream, contentType, options?: IOptions): Promise<IAudioMetadata> {
const ns = new Browser2NodeStream(stream);
const ns = new ReadableWeToNodeStream(stream);
const res = await parseNodeStream(ns, contentType, options);
debug(`Completed parsing from stream bytesRead=${ns.bytesRead} / fileSize=${options && options.fileSize ? options.fileSize : '?'}`);
await ns.close();
Expand Down
6 changes: 6 additions & 0 deletions yarn.lock
Expand Up @@ -3693,6 +3693,12 @@ readable-stream@^3.3.0:
string_decoder "^1.1.1"
util-deprecate "^1.0.1"

readable-web-to-node-stream@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/readable-web-to-node-stream/-/readable-web-to-node-stream-1.0.0.tgz#dec81947215beb4b39ef46d6686b06a1090be2ea"
dependencies:
debug "^4.1.1"

readdirp@^2.0.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525"
Expand Down

0 comments on commit b1d80ff

Please sign in to comment.