diskio-api 1.5.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,10 @@ export declare class DiskioAPIClient {
96
96
  } & {
97
97
  response: string[];
98
98
  }) | undefined>;
99
- download(uuid: string, type?: 'arrayBuffer' | 'stream'): Promise<{
99
+ download(uuid: string, type?: 'arrayBuffer' | 'stream', range?: {
100
+ from: number;
101
+ to?: number;
102
+ }): Promise<{
100
103
  size: string | null;
101
104
  stream: ArrayBuffer | ReadableStream<Uint8Array<ArrayBuffer>> | null | undefined;
102
105
  }>;
package/cjs/index.js CHANGED
@@ -38,8 +38,10 @@ 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 });
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 });
43
45
  const size = response.response.headers.get('Content-Length');
44
46
  return { size, stream: response.data };
45
47
  }
package/mjs/index.d.ts CHANGED
@@ -96,7 +96,10 @@ export declare class DiskioAPIClient {
96
96
  } & {
97
97
  response: string[];
98
98
  }) | undefined>;
99
- download(uuid: string, type?: 'arrayBuffer' | 'stream'): Promise<{
99
+ download(uuid: string, type?: 'arrayBuffer' | 'stream', range?: {
100
+ from: number;
101
+ to?: number;
102
+ }): Promise<{
100
103
  size: string | null;
101
104
  stream: ArrayBuffer | ReadableStream<Uint8Array<ArrayBuffer>> | null | undefined;
102
105
  }>;
package/mjs/index.js CHANGED
@@ -32,8 +32,10 @@ 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 });
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 });
37
39
  const size = response.response.headers.get('Content-Length');
38
40
  return { size, stream: response.data };
39
41
  }
@@ -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.5.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",