From 2eadd7d0b344df451768dd44ec4463803f388fed Mon Sep 17 00:00:00 2001 From: Alex Caza Date: Fri, 26 Jul 2024 14:35:18 -0400 Subject: [PATCH] Use new mediaType option --- lib/generator.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/generator.ts b/lib/generator.ts index c7175e9..369749d 100644 --- a/lib/generator.ts +++ b/lib/generator.ts @@ -67,10 +67,12 @@ export const asBlob = const withDefaults = mkConfig(config); const data = unpack(csvOutput); - // Create blob from CsvOutput either as text or csv file. - const fileType = withDefaults.useTextFile ? "plain" : "csv"; + // Create blob from CsvOutput using the supplied mime type. + const mimeType = withDefaults.useTextFile + ? "text/plain" + : withDefaults.mediaType; const blob = new Blob([data], { - type: `text/${fileType};charset=utf8;`, + type: `${mimeType};charset=utf8;`, }); return blob;