diskio-api 1.4.0 → 1.6.0

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.
package/cjs/index.d.ts CHANGED
@@ -96,7 +96,13 @@ export declare class DiskioAPIClient {
96
96
  } & {
97
97
  response: string[];
98
98
  }) | undefined>;
99
- download(uuid: string, type?: 'arrayBuffer' | 'stream'): Promise<ArrayBuffer | ReadableStream<Uint8Array<ArrayBuffer>> | null | undefined>;
99
+ download(uuid: string, type?: 'arrayBuffer' | 'stream', range?: {
100
+ from: number;
101
+ to?: number;
102
+ }): Promise<{
103
+ size: string | null;
104
+ stream: ArrayBuffer | ReadableStream<Uint8Array<ArrayBuffer>> | null | undefined;
105
+ }>;
100
106
  delete(uuid: string): Promise<import("openapi-fetch").FetchResponse<{
101
107
  parameters: {
102
108
  query?: never;
package/cjs/index.js CHANGED
@@ -38,9 +38,12 @@ class DiskioAPIClient {
38
38
  const response = this.client.POST('/diskio', { body: formData });
39
39
  return response.data;
40
40
  }
41
- async download(uuid, type = 'arrayBuffer') {
42
- const response = this.client.GET('/diskio/{uuid}', { params: { path: { uuid } }, parseAs: type });
43
- return response.data;
41
+ async download(uuid, type = 'arrayBuffer', range) {
42
+ var _a;
43
+ const Range = range ? `bytes=${range.from}-${(_a = range.to) !== null && _a !== void 0 ? _a : ''}` : '';
44
+ const response = this.client.GET('/diskio/{uuid}', { params: { path: { uuid }, header: { Range } }, parseAs: type });
45
+ const size = response.response.headers.get('Content-Length');
46
+ return { size, stream: response.data };
44
47
  }
45
48
  delete(uuid) {
46
49
  return this.client.DELETE('/diskio/{uuid}', { params: { path: { uuid } } });
package/mjs/index.d.ts CHANGED
@@ -96,7 +96,13 @@ export declare class DiskioAPIClient {
96
96
  } & {
97
97
  response: string[];
98
98
  }) | undefined>;
99
- download(uuid: string, type?: 'arrayBuffer' | 'stream'): Promise<ArrayBuffer | ReadableStream<Uint8Array<ArrayBuffer>> | null | undefined>;
99
+ download(uuid: string, type?: 'arrayBuffer' | 'stream', range?: {
100
+ from: number;
101
+ to?: number;
102
+ }): Promise<{
103
+ size: string | null;
104
+ stream: ArrayBuffer | ReadableStream<Uint8Array<ArrayBuffer>> | null | undefined;
105
+ }>;
100
106
  delete(uuid: string): Promise<import("openapi-fetch").FetchResponse<{
101
107
  parameters: {
102
108
  query?: never;
package/mjs/index.js CHANGED
@@ -32,9 +32,12 @@ export class DiskioAPIClient {
32
32
  const response = await this.client.POST('/diskio', { body: formData });
33
33
  return response.data;
34
34
  }
35
- async download(uuid, type = 'arrayBuffer') {
36
- const response = await this.client.GET('/diskio/{uuid}', { params: { path: { uuid } }, parseAs: type });
37
- return response.data;
35
+ async download(uuid, type = 'arrayBuffer', range) {
36
+ var _a;
37
+ const Range = range ? `bytes=${range.from}-${(_a = range.to) !== null && _a !== void 0 ? _a : ''}` : '';
38
+ const response = await this.client.GET('/diskio/{uuid}', { params: { path: { uuid }, header: { Range } }, parseAs: type });
39
+ const size = response.response.headers.get('Content-Length');
40
+ return { size, stream: response.data };
38
41
  }
39
42
  delete(uuid) {
40
43
  return this.client.DELETE('/diskio/{uuid}', { params: { path: { uuid } } });
@@ -119,7 +119,10 @@ export interface paths {
119
119
  get: {
120
120
  parameters: {
121
121
  query?: never;
122
- header?: never;
122
+ header?: {
123
+ /** @description Standard RFC 7233 range header */
124
+ Range?: string;
125
+ };
123
126
  path: {
124
127
  uuid: string;
125
128
  };
@@ -182,6 +182,16 @@
182
182
  "type": "string",
183
183
  "example": "7b1d2a45/1211/4517/b968/dbb6799aef6b/meme.mp4"
184
184
  }
185
+ },
186
+ {
187
+ "name": "Range",
188
+ "in": "header",
189
+ "description": "Standard RFC 7233 range header",
190
+ "required": false,
191
+ "schema": {
192
+ "type": "string",
193
+ "example": "bytes=0-1024"
194
+ }
185
195
  }
186
196
  ],
187
197
  "responses": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diskio-api",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "An API Client for diskio-server",
5
5
  "type": "module",
6
6
  "main": "cjs/index.js",