@datapos/datapos-tool-file-operators 0.0.14 → 0.0.16
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.
|
@@ -8270,8 +8270,7 @@ class rx {
|
|
|
8270
8270
|
*/
|
|
8271
8271
|
async previewFile(e, x, t) {
|
|
8272
8272
|
const a = await fetch(encodeURI(e), { headers: { Range: `bytes=0-${t ?? Ze - 1}` }, signal: x });
|
|
8273
|
-
if (!a.ok)
|
|
8274
|
-
throw await Ae(a, `Failed to fetch '${e}' file.`, "datapos-tool-file-operators.previewRemoteFile");
|
|
8273
|
+
if (!a.ok) throw await Ae(a, `Failed to fetch '${e}' file.`, "datapos-tool-file-operators.previewRemoteFile");
|
|
8275
8274
|
const n = new Uint8Array(await a.arrayBuffer());
|
|
8276
8275
|
return await $e(n);
|
|
8277
8276
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { FileTypeResult } from 'file-type';
|
|
2
2
|
import { DataFormatId } from '@datapos/datapos-shared/component/dataView';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* File preview result.
|
|
5
|
+
*/
|
|
6
|
+
interface FilePreviewResult {
|
|
4
7
|
bytes: Uint8Array;
|
|
5
8
|
dataFormatId: DataFormatId | undefined;
|
|
6
9
|
encodingId: string | undefined;
|
|
@@ -15,6 +18,6 @@ declare class Tool {
|
|
|
15
18
|
/**
|
|
16
19
|
* Preview file.
|
|
17
20
|
*/
|
|
18
|
-
previewFile(url: string, signal: AbortSignal, chunkSize?: number): Promise<
|
|
21
|
+
previewFile(url: string, signal: AbortSignal, chunkSize?: number): Promise<FilePreviewResult>;
|
|
19
22
|
}
|
|
20
|
-
export { type
|
|
23
|
+
export { type FilePreviewResult, Tool };
|