remove StreamUtils
This commit is contained in:
parent
1d55792f1f
commit
bd4bcb93d0
4 changed files with 5 additions and 39 deletions
|
@ -16,6 +16,7 @@
|
|||
"@typescript-eslint/no-unused-vars": "error",
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
"@typescript-eslint/ban-ts-comment": "error",
|
||||
"semi": "error"
|
||||
"semi": "error",
|
||||
"no-console": "error"
|
||||
}
|
||||
}
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"restructuredtext.languageServer.disabled": true
|
||||
}
|
|
@ -4,7 +4,6 @@ export { Playlist } from "./Structures/Playlist";
|
|||
export { Player } from "./Player";
|
||||
export { QueryResolver } from "./utils/QueryResolver";
|
||||
export { Queue } from "./Structures/Queue";
|
||||
export { StreamUtils } from "./utils/StreamUtils";
|
||||
export { Track } from "./Structures/Track";
|
||||
export { Util } from "./utils/Util";
|
||||
export { VoiceUtils } from "./VoiceInterface/VoiceUtils";
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
import { Duplex, Readable, PassThrough } from "stream";
|
||||
|
||||
class StreamUtils {
|
||||
/**
|
||||
* Stream utils
|
||||
*/
|
||||
constructor() {
|
||||
throw new Error("Cannot instantiate static class");
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to re-create used streams
|
||||
* @param {Readable|Duplex} stream The used stream
|
||||
* @returns {Readable}
|
||||
*/
|
||||
static clone(stream: Readable | Duplex): Readable {
|
||||
const passed = stream.pipe(new PassThrough());
|
||||
return passed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts stream to buffer
|
||||
* @param {Readable|Duplex} stream The stream
|
||||
* @returns {Promise<Buffer>}
|
||||
*/
|
||||
static toBuffer(stream: Readable | Duplex): Promise<Buffer> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const chunks: Buffer[] = [];
|
||||
|
||||
stream.on("data", (chunk) => chunks.push(chunk));
|
||||
stream.on("end", () => resolve(Buffer.concat(chunks)));
|
||||
stream.on("error", reject);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { StreamUtils };
|
Loading…
Reference in a new issue