From e21edb1c8b5fd981607e4196883d4941bc0bf2db Mon Sep 17 00:00:00 2001 From: Borewit Date: Tue, 26 Nov 2019 19:16:21 +0100 Subject: [PATCH 1/2] Switch from streaming-http-token-reader to @tokenizer/range --- lib/index.ts | 13 ++++++------- package.json | 2 +- yarn.lock | 23 +++++++++-------------- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index c4c910f..174453a 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,7 +1,6 @@ import * as S3 from 'aws-sdk/clients/s3'; import { parseFromTokenizer, parseStream } from 'music-metadata/lib/core'; -import { StreamingHttpTokenReader, IHttpClient, IHttpResponse } from 'streaming-http-token-reader'; -import { parseContentRange } from 'streaming-http-token-reader/lib/http-client'; +import { RangeRequestTokenizer, IRangeRequestClient, IRangeRequestResponse, parseContentRange } from '@tokenizer/range'; import { AWSError, Request } from 'aws-sdk'; import { IOptions, IAudioMetadata } from 'music-metadata/lib/type'; @@ -17,12 +16,12 @@ interface IS3Options extends IOptions { /** * Use S3-client to execute actual HTTP-requests. */ -class S3Request implements IHttpClient { +class S3Request implements IRangeRequestClient { constructor(private s3client: MMS3Client, private objRequest: S3.Types.GetObjectRequest) { } - public async getResponse(method, range: number[]): Promise { + public async getResponse(method, range: number[]): Promise { return this.s3client.getRangedRequest(this.objRequest, range).promise().then(data => { return { @@ -69,11 +68,11 @@ export class MMS3Client { return parseStream(stream, info.ContentType, options); } else { const s3Request = new S3Request(this, objRequest); - const streamingHttpTokenReader = new StreamingHttpTokenReader(s3Request, { + const rangeRequestTokenizer = new RangeRequestTokenizer(s3Request, { avoidHeadRequests: true }); - await streamingHttpTokenReader.init(); - return parseFromTokenizer(streamingHttpTokenReader, streamingHttpTokenReader.contentType, options); + await rangeRequestTokenizer.init(); + return parseFromTokenizer(rangeRequestTokenizer, rangeRequestTokenizer.contentType, options); } } } diff --git a/package.json b/package.json index 96ecefc..bdcfed8 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ }, "dependencies": { "music-metadata": "^5.0.0", - "streaming-http-token-reader": "^0.3.1" + "@tokenizer/range": "^0.1.0" }, "devDependencies": { "aws-sdk": "^2.528.0", diff --git a/yarn.lock b/yarn.lock index 8c11ac4..bf80951 100644 --- a/yarn.lock +++ b/yarn.lock @@ -39,6 +39,15 @@ "@nodelib/fs.scandir" "2.1.3" fastq "^1.6.0" +"@tokenizer/range@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@tokenizer/range/-/range-0.1.0.tgz#3be97516213694a4995c08dee869c32ff3555f02" + integrity sha512-wIojK1GDoD4lhuaDganB5JiOtNOWzRJnVgwKSdUQmx+UYiQpLWR02JpOoJcy9P7/rT78Pb86BkfmyTLLXc/XOg== + dependencies: + debug "^4.1.1" + mocha "^6.2.2" + strtok3 "^3.0.4" + "@types/events@*": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" @@ -874,11 +883,6 @@ node-environment-flags@1.0.5: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" -node-fetch@^2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" - integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== - normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -1149,15 +1153,6 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= -streaming-http-token-reader@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/streaming-http-token-reader/-/streaming-http-token-reader-0.3.1.tgz#fab384060fb214d7ffa70f00a4c669413695370f" - integrity sha512-8HLGXNvGvGWgwACaHXbj5DSPCItXn9rbXkzz6q3uDYTjjx1lqhCGKttHUC8iqDFPY7U2FcpXh3A4WKr6EiXntg== - dependencies: - debug "^4.1.1" - node-fetch "^2.6.0" - strtok3 "^3.0.4" - "string-width@^1.0.2 || 2": version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" From 341c203f7352fc7b2553abbb5922219a74d94e02 Mon Sep 17 00:00:00 2001 From: Borewit Date: Tue, 3 Dec 2019 07:23:18 +0100 Subject: [PATCH 2/2] Auto-merge @types/chai --- .dependabot/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.dependabot/config.yml b/.dependabot/config.yml index cd9d77c..18f4a9f 100644 --- a/.dependabot/config.yml +++ b/.dependabot/config.yml @@ -7,6 +7,9 @@ update_configs: - match: dependency_name: "@types/node" update_type: "semver:minor" + - match: + dependency_name: "@types/chai" + update_type: "semver:minor" - match: dependency_name: "ts-node" - match: