Skip to content

Commit

Permalink
Use new mediaType option
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcaza committed Aug 31, 2024
1 parent 1a92073 commit 2eadd7d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2eadd7d

Please sign in to comment.