From af2441a875955fa3e3bd3a0d6c91f29f9fc438c4 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Sun, 15 Sep 2024 15:03:46 +1000 Subject: [PATCH] fix: add filename to export response on toolbox --- deno.json | 2 +- toolbox.ts | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/deno.json b/deno.json index dc80f81..8a5958f 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@kitsonk/kv-toolbox", - "version": "0.19.0-beta.5", + "version": "0.19.0-beta.6", "exports": { ".": "./toolbox.ts", "./batched_atomic": "./batched_atomic.ts", diff --git a/toolbox.ts b/toolbox.ts index ddd3436..203e8e5 100644 --- a/toolbox.ts +++ b/toolbox.ts @@ -290,7 +290,16 @@ export class KvToolbox implements Disposable { */ export( selector: Deno.KvListSelector, - options: { close?: boolean; response: true }, + options: { + close?: boolean; + response: true; + /** + * If provided, the response will include a header that indicates the file is + * meant to be downloaded (`Content-Disposition`). The extension `.ndjson` + * will be appended to the filename. + */ + filename?: string; + }, ): Response; /** * Like {@linkcode Deno.Kv} `.list()` method, but returns a @@ -316,7 +325,7 @@ export class KvToolbox implements Disposable { export( selector: Deno.KvListSelector, options: - | { close?: boolean; response: true } + | { close?: boolean; response: true; filename?: string } | ( | ExportEntriesOptionsJSON | ExportEntriesOptionsBytes