Skip to content

Commit

Permalink
fix: fix compiling for @types/node@17
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Jan 9, 2022
1 parent 09f6dfd commit d50f9ab
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
"lint:fix": "eslint --fix ./src ./test"
},
"dependencies": {
"miniget": "^4.2.1",
"miniget": "^4.2.2",
"sax": "^1.2.4"
},
"devDependencies": {
"@types/mocha": "^7.0.0",
"@types/node": "^13.1.0",
"@types/node": "^17.0.8",
"@types/sax": "^1.0.1",
"@types/sinon": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^4.8.2",
Expand Down
2 changes: 1 addition & 1 deletion src/dash-mpd-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export default class DashMPDParser extends Writable implements Parser {
}

_write(chunk: Buffer, encoding: string, callback: () => void): void {
this._parser.write(chunk, encoding);
this._parser.write(chunk);
callback();
}
}
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace m3u8stream {
url: string;
}
export interface Stream extends PassThrough {
end: () => void;
end: () => this;
on(event: 'progress', listener: (progress: Progress, totalSegments: number, downloadedBytes: number) => void): this;
on(event: string | symbol, listener: (...args: any) => void): this;
}
Expand Down Expand Up @@ -204,14 +204,15 @@ let m3u8stream = ((playlistURL: string, options: m3u8stream.Options = {}): m3u8s
};
refreshPlaylist();

stream.end = (): void => {
stream.end = () => {
ended = true;
streamQueue.die();
requestQueue.die();
clearTimeout(refreshTimeout);
currPlaylist?.destroy();
currSegment?.destroy();
PassThrough.prototype.end.call(stream, null);
return stream;
};

return stream;
Expand Down
2 changes: 1 addition & 1 deletion test/main-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const concat = (stream: PassThrough, callback: (err: Error | null, body: string)

describe('m3u8stream', () => {
let setTimeout = global.setTimeout;
before(() => { global.setTimeout = (fn, ms, ...args) => setTimeout(fn, 0, ...args); });
before(() => { global.setTimeout = process.nextTick as typeof global.setTimeout; });
after(() => { global.setTimeout = setTimeout; });

describe('Simple media playlist', () => {
Expand Down

0 comments on commit d50f9ab

Please sign in to comment.