From faff5ea97a46beb78caf8198b9a38e7e5df46fa2 Mon Sep 17 00:00:00 2001 From: Borewit Date: Tue, 17 Dec 2024 12:24:11 +0100 Subject: [PATCH] Convert Iterator of detectors to array of detectors, keeping backwards compatibility --- core.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core.js b/core.js index f729e05e..388f00a0 100644 --- a/core.js +++ b/core.js @@ -57,11 +57,10 @@ export async function fileTypeStream(webStream, options) { export class FileTypeParser { constructor(options) { - this.detectors = options?.customDetectors ?? []; + this.detectors = [...(options?.customDetectors ?? []), this.parse]; this.tokenizerOptions = { abortSignal: options?.signal, }; - this.detectors.push(this.parse); // Assign core file-type detector } async fromTokenizer(tokenizer) {