@dpuse/dpuse-tool-file-previewer 1.0.133 → 1.0.135
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/README.md +10 -12
- package/dist/dpuse-tool-file-previewer.es.js +6597 -6575
- package/dist/dpuse-tool-file-previewer.es.js.map +1 -1
- package/dist/shipped-packages.json +1 -1
- package/dist/types/src/encoding.d.ts +20 -0
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/jsonDetection.d.ts +2 -0
- package/package.json +5 -5
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EncodingDetectionConfig, EncodingSourceId } from '@dpuse/dpuse-shared';
|
|
2
|
+
export interface DecodingEncoding {
|
|
3
|
+
confidenceLevel: number | undefined;
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export interface EncodingDetection {
|
|
7
|
+
encoding: DecodingEncoding;
|
|
8
|
+
sourceId: EncodingSourceId;
|
|
9
|
+
}
|
|
10
|
+
export interface DecodedText {
|
|
11
|
+
encoding: DecodingEncoding;
|
|
12
|
+
replacementCharacterCount: number;
|
|
13
|
+
text: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function detectTextEncoding(fileBytes: Uint8Array, isComplete: boolean): EncodingDetection & {
|
|
16
|
+
candidates: EncodingDetectionConfig[];
|
|
17
|
+
};
|
|
18
|
+
export declare function detectXMLEncoding(fileBytes: Uint8Array): EncodingDetection;
|
|
19
|
+
export declare function decodeFileBytes(fileBytes: Uint8Array, encoding: DecodingEncoding, isComplete: boolean): DecodedText;
|
|
20
|
+
export declare function decodeBytesAsCharacters(fileBytes: Uint8Array): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FilePreviewerInterface, FilePreviewResult
|
|
1
|
+
import { FilePreviewerInterface, FilePreviewResult } from '@dpuse/dpuse-shared';
|
|
2
2
|
export declare class Tool implements FilePreviewerInterface {
|
|
3
|
-
previewFile(url: string, signal: AbortSignal, chunkSize?: number, mimeType?: string,
|
|
3
|
+
previewFile(url: string, signal: AbortSignal, chunkSize?: number, mimeType?: string, encodingId?: string): Promise<FilePreviewResult>;
|
|
4
4
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dpuse/dpuse-tool-file-previewer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.135",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "A library that wraps file-type and jschardet to identify a file's format and encoding from its first bytes, and return a decoded sample of its text.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Jonathan Terrell <terrell.jm@gmail.com>",
|
|
8
8
|
"type": "module",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"test": "node -e \"import('@dpuse/dpuse-development').then(m => m.testProject())\""
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@dpuse/dpuse-shared": "^1.0.
|
|
64
|
+
"@dpuse/dpuse-shared": "^1.0.210",
|
|
65
65
|
"file-type": "^22.3.0",
|
|
66
66
|
"jschardet": "^4.1.0"
|
|
67
67
|
},
|
|
@@ -71,12 +71,12 @@
|
|
|
71
71
|
"@types/node": "^26.6.6",
|
|
72
72
|
"@vitest/coverage-v8": "^5.1.0",
|
|
73
73
|
"eslint": "^10.14.0",
|
|
74
|
-
"prettier": "^3.
|
|
74
|
+
"prettier": "^3.10.0",
|
|
75
75
|
"sonda": "^0.14.0",
|
|
76
76
|
"typescript": "^6.0.3",
|
|
77
77
|
"vite": "^8.3.8",
|
|
78
78
|
"vite-plugin-dts": "^5.1.2",
|
|
79
79
|
"vitest": "^5.1.0",
|
|
80
|
-
"wrangler": "^4.160.
|
|
80
|
+
"wrangler": "^4.160.1"
|
|
81
81
|
}
|
|
82
82
|
}
|