@sparkvault/sdk-js 11.2.3 → 11.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -213,8 +213,14 @@ export declare class IngotsModule {
213
213
  * and a link that is not a Forge decrypt URL on an allowed host, is final.
214
214
  *
215
215
  * @example
216
+ * const ingot = await sv.ingots.get(unsealed, 'ing_abc');
216
217
  * const blob = await sv.ingots.download(unsealed, 'ing_abc');
217
- * const url = URL.createObjectURL(blob);
218
+ * // Saved under the name Forge would send, as opaque bytes, which no
219
+ * // browser renames by a type (see Ingot.downloadFilename).
220
+ * const link = document.createElement('a');
221
+ * link.href = URL.createObjectURL(new Blob([blob], { type: 'application/octet-stream' }));
222
+ * link.download = ingot.downloadFilename;
223
+ * link.click();
218
224
  */
219
225
  download(vault: UnsealedVault, ingotId: string): Promise<Blob>;
220
226
  /**
@@ -32,6 +32,22 @@ export interface Ingot {
32
32
  id: string;
33
33
  /** Ingot name */
34
34
  name: string;
35
+ /**
36
+ * The name a download of the ingot saves under, as Forge names it: `name`,
37
+ * kept as it is when the first word of the extension it shows (up to an
38
+ * ASCII space, in any case) is one the MIME registry knows or holds a
39
+ * character none of the registry's extensions is spelled with, which may
40
+ * draw as one, and otherwise completed with the first extension the
41
+ * registry lists for `contentType`, never one a saved copy must never open
42
+ * as. Save a copy under it, handed to a browser as
43
+ * `application/octet-stream` unless `contentType` is a raster image, audio,
44
+ * video or PDF format (never SVG, a playlist or a stream redirector): a
45
+ * browser renames a saved copy by the type it is handed (Chrome saves
46
+ * `Invoice` typed `application/x-msdownload` as `Invoice.exe`), and
47
+ * completes or replaces no extension of a copy handed as
48
+ * `application/octet-stream`.
49
+ */
50
+ downloadFilename: string;
35
51
  /** Content type (MIME) */
36
52
  contentType: string;
37
53
  /** Size in bytes */
@@ -323,6 +339,7 @@ export interface AccessLogsOptions {
323
339
  export interface IngotWire {
324
340
  ingot_id: string;
325
341
  name: string;
342
+ download_filename: string;
326
343
  content_type: string;
327
344
  size_bytes: number;
328
345
  status?: Ingot['status'];
@@ -46,6 +46,22 @@ export interface Spark {
46
46
  burnedAt: number;
47
47
  /** Optional file name (for file payloads) */
48
48
  filename?: string;
49
+ /**
50
+ * The name the payload saves under: `filename`, or `download` for a spark
51
+ * with none, kept as it is when the first word of the extension it shows
52
+ * (up to an ASCII space, in any case) is one the MIME registry knows or
53
+ * holds a character none of the registry's extensions is spelled with,
54
+ * which may draw as one, and otherwise completed with the first extension
55
+ * the registry lists for `contentType`, never one a saved copy must never
56
+ * open as. Save a copy under it, handed to a browser as
57
+ * `application/octet-stream` unless `contentType` is a raster image, audio,
58
+ * video or PDF format (never SVG, a playlist or a stream redirector): a
59
+ * browser renames a saved copy by the type it is handed (Chrome saves
60
+ * `Invoice` typed `application/x-msdownload` as `Invoice.exe`), and
61
+ * completes or replaces no extension of a copy handed as
62
+ * `application/octet-stream`.
63
+ */
64
+ downloadFilename: string;
49
65
  }
50
66
  /** A newly created spark. */
51
67
  export interface CreatedSpark {
@@ -155,6 +171,7 @@ export interface SparkResponse {
155
171
  created_at: number;
156
172
  burned_at: number;
157
173
  filename?: string;
174
+ download_filename: string;
158
175
  }
159
176
  export interface CreateSparkResponse {
160
177
  spark_id: string;