@lvce-editor/file-system-worker 5.20.1 → 5.20.3
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/dist/fileSystemWorkerMain.js +129 -275
- package/package.json +1 -1
|
@@ -1,160 +1,3 @@
|
|
|
1
|
-
// TODO: including these in blob-util.ts causes typedoc to generate docs for them,
|
|
2
|
-
// even with --excludePrivate ¯\_(ツ)_/¯
|
|
3
|
-
/** @private */
|
|
4
|
-
|
|
5
|
-
/* global Promise, Image, Blob, FileReader, atob, btoa,
|
|
6
|
-
BlobBuilder, MSBlobBuilder, MozBlobBuilder, WebKitBlobBuilder, webkitURL */
|
|
7
|
-
/**
|
|
8
|
-
* Shim for
|
|
9
|
-
* [`new Blob()`](https://developer.mozilla.org/en-US/docs/Web/API/Blob.Blob)
|
|
10
|
-
* to support
|
|
11
|
-
* [older browsers that use the deprecated `BlobBuilder` API](http://caniuse.com/blob).
|
|
12
|
-
*
|
|
13
|
-
* Example:
|
|
14
|
-
*
|
|
15
|
-
* ```js
|
|
16
|
-
* var myBlob = blobUtil.createBlob(['hello world'], {type: 'text/plain'});
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* @param parts - content of the Blob
|
|
20
|
-
* @param properties - usually `{type: myContentType}`,
|
|
21
|
-
* you can also pass a string for the content type
|
|
22
|
-
* @returns Blob
|
|
23
|
-
*/
|
|
24
|
-
function createBlob(parts, properties) {
|
|
25
|
-
parts = parts || [];
|
|
26
|
-
properties = properties || {};
|
|
27
|
-
if (typeof properties === 'string') {
|
|
28
|
-
properties = {
|
|
29
|
-
type: properties
|
|
30
|
-
}; // infer content type
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
return new Blob(parts, properties);
|
|
34
|
-
} catch (e) {
|
|
35
|
-
if (e.name !== 'TypeError') {
|
|
36
|
-
throw e;
|
|
37
|
-
}
|
|
38
|
-
var Builder = typeof BlobBuilder !== 'undefined' ? BlobBuilder : typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder : typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : WebKitBlobBuilder;
|
|
39
|
-
var builder = new Builder();
|
|
40
|
-
for (var i = 0; i < parts.length; i += 1) {
|
|
41
|
-
builder.append(parts[i]);
|
|
42
|
-
}
|
|
43
|
-
return builder.getBlob(properties.type);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Convert a `Blob` to a binary string.
|
|
48
|
-
*
|
|
49
|
-
* Example:
|
|
50
|
-
*
|
|
51
|
-
* ```js
|
|
52
|
-
* blobUtil.blobToBinaryString(blob).then(function (binaryString) {
|
|
53
|
-
* // success
|
|
54
|
-
* }).catch(function (err) {
|
|
55
|
-
* // error
|
|
56
|
-
* });
|
|
57
|
-
* ```
|
|
58
|
-
*
|
|
59
|
-
* @param blob
|
|
60
|
-
* @returns Promise that resolves with the binary string
|
|
61
|
-
*/
|
|
62
|
-
function blobToBinaryString$1(blob) {
|
|
63
|
-
return new Promise(function (resolve, reject) {
|
|
64
|
-
var reader = new FileReader();
|
|
65
|
-
var hasBinaryString = typeof reader.readAsBinaryString === 'function';
|
|
66
|
-
reader.onloadend = function () {
|
|
67
|
-
var result = reader.result || '';
|
|
68
|
-
if (hasBinaryString) {
|
|
69
|
-
return resolve(result);
|
|
70
|
-
}
|
|
71
|
-
resolve(arrayBufferToBinaryString(result));
|
|
72
|
-
};
|
|
73
|
-
reader.onerror = reject;
|
|
74
|
-
if (hasBinaryString) {
|
|
75
|
-
reader.readAsBinaryString(blob);
|
|
76
|
-
} else {
|
|
77
|
-
reader.readAsArrayBuffer(blob);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Convert a base64-encoded string to a `Blob`.
|
|
83
|
-
*
|
|
84
|
-
* Example:
|
|
85
|
-
*
|
|
86
|
-
* ```js
|
|
87
|
-
* var blob = blobUtil.base64StringToBlob(base64String);
|
|
88
|
-
* ```
|
|
89
|
-
* @param base64 - base64-encoded string
|
|
90
|
-
* @param type - the content type (optional)
|
|
91
|
-
* @returns Blob
|
|
92
|
-
*/
|
|
93
|
-
function base64StringToBlob(base64, type) {
|
|
94
|
-
var parts = [binaryStringToArrayBuffer(atob(base64))];
|
|
95
|
-
return type ? createBlob(parts, {
|
|
96
|
-
type: type
|
|
97
|
-
}) : createBlob(parts);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Convert a binary string to a `Blob`.
|
|
101
|
-
*
|
|
102
|
-
* Example:
|
|
103
|
-
*
|
|
104
|
-
* ```js
|
|
105
|
-
* var blob = blobUtil.binaryStringToBlob(binaryString);
|
|
106
|
-
* ```
|
|
107
|
-
*
|
|
108
|
-
* @param binary - binary string
|
|
109
|
-
* @param type - the content type (optional)
|
|
110
|
-
* @returns Blob
|
|
111
|
-
*/
|
|
112
|
-
function binaryStringToBlob$1(binary, type) {
|
|
113
|
-
return base64StringToBlob(btoa(binary), type);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Convert an `ArrayBuffer` to a binary string.
|
|
117
|
-
*
|
|
118
|
-
* Example:
|
|
119
|
-
*
|
|
120
|
-
* ```js
|
|
121
|
-
* var myString = blobUtil.arrayBufferToBinaryString(arrayBuff)
|
|
122
|
-
* ```
|
|
123
|
-
*
|
|
124
|
-
* @param buffer - array buffer
|
|
125
|
-
* @returns binary string
|
|
126
|
-
*/
|
|
127
|
-
function arrayBufferToBinaryString(buffer) {
|
|
128
|
-
var binary = '';
|
|
129
|
-
var bytes = new Uint8Array(buffer);
|
|
130
|
-
var length = bytes.byteLength;
|
|
131
|
-
var i = -1;
|
|
132
|
-
while (++i < length) {
|
|
133
|
-
binary += String.fromCharCode(bytes[i]);
|
|
134
|
-
}
|
|
135
|
-
return binary;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Convert a binary string to an `ArrayBuffer`.
|
|
139
|
-
*
|
|
140
|
-
* ```js
|
|
141
|
-
* var myBuffer = blobUtil.binaryStringToArrayBuffer(binaryString)
|
|
142
|
-
* ```
|
|
143
|
-
*
|
|
144
|
-
* @param binary - binary string
|
|
145
|
-
* @returns array buffer
|
|
146
|
-
*/
|
|
147
|
-
function binaryStringToArrayBuffer(binary) {
|
|
148
|
-
var length = binary.length;
|
|
149
|
-
var buf = new ArrayBuffer(length);
|
|
150
|
-
var arr = new Uint8Array(buf);
|
|
151
|
-
var i = -1;
|
|
152
|
-
while (++i < length) {
|
|
153
|
-
arr[i] = binary.charCodeAt(i);
|
|
154
|
-
}
|
|
155
|
-
return buf;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
1
|
const normalizeLine = line => {
|
|
159
2
|
if (line.startsWith('Error: ')) {
|
|
160
3
|
return line.slice('Error: '.length);
|
|
@@ -865,6 +708,9 @@ const restoreExistingError = (error, currentStack) => {
|
|
|
865
708
|
};
|
|
866
709
|
const restoreMethodNotFoundError = (error, currentStack) => {
|
|
867
710
|
const restoredError = new JsonRpcError(error.message);
|
|
711
|
+
Object.assign(restoredError, {
|
|
712
|
+
code: error.code
|
|
713
|
+
});
|
|
868
714
|
const parentStack = getParentStack(error);
|
|
869
715
|
setStack(restoredError, `${parentStack}${NewLine}${currentStack}`);
|
|
870
716
|
return restoredError;
|
|
@@ -884,9 +730,13 @@ const applyDataProperties = (restoredError, error) => {
|
|
|
884
730
|
// @ts-ignore
|
|
885
731
|
restoredError.codeFrame = error.data.codeFrame;
|
|
886
732
|
}
|
|
887
|
-
if (error.data.code) {
|
|
733
|
+
if (typeof error.data.code === 'string' || typeof error.data.code === 'number') {
|
|
888
734
|
// @ts-ignore
|
|
889
|
-
restoredError
|
|
735
|
+
Object.defineProperty(restoredError, 'code', {
|
|
736
|
+
configurable: true,
|
|
737
|
+
value: error.data.code,
|
|
738
|
+
writable: true
|
|
739
|
+
});
|
|
890
740
|
}
|
|
891
741
|
if (error.data.type) {
|
|
892
742
|
// @ts-ignore
|
|
@@ -907,7 +757,14 @@ const applyDirectProperties = (restoredError, error) => {
|
|
|
907
757
|
}
|
|
908
758
|
};
|
|
909
759
|
const restoreMessageError = (error, _currentStack) => {
|
|
910
|
-
const restoredError = constructError(error.message, error.type, error.name);
|
|
760
|
+
const restoredError = constructError(error.message, error.type || error.data?.type, error.name);
|
|
761
|
+
if (typeof error.code === 'string' || typeof error.code === 'number') {
|
|
762
|
+
Object.defineProperty(restoredError, 'code', {
|
|
763
|
+
configurable: true,
|
|
764
|
+
value: error.code,
|
|
765
|
+
writable: true
|
|
766
|
+
});
|
|
767
|
+
}
|
|
911
768
|
if (error.data) {
|
|
912
769
|
applyDataProperties(restoredError, error);
|
|
913
770
|
} else {
|
|
@@ -915,6 +772,23 @@ const restoreMessageError = (error, _currentStack) => {
|
|
|
915
772
|
}
|
|
916
773
|
return restoredError;
|
|
917
774
|
};
|
|
775
|
+
const getFallbackMessage = error => {
|
|
776
|
+
if (error && typeof error.message === 'string' && error.message) {
|
|
777
|
+
return error.message;
|
|
778
|
+
}
|
|
779
|
+
if (error && error.data) {
|
|
780
|
+
return getFallbackMessage(error.data);
|
|
781
|
+
}
|
|
782
|
+
const stringified = String(error);
|
|
783
|
+
if (stringified !== '[object Object]') {
|
|
784
|
+
return stringified;
|
|
785
|
+
}
|
|
786
|
+
try {
|
|
787
|
+
return JSON.stringify(error);
|
|
788
|
+
} catch {
|
|
789
|
+
return stringified;
|
|
790
|
+
}
|
|
791
|
+
};
|
|
918
792
|
const restoreJsonRpcError = error => {
|
|
919
793
|
const currentStack = getCurrentStack();
|
|
920
794
|
if (error && error instanceof Error) {
|
|
@@ -923,13 +797,13 @@ const restoreJsonRpcError = error => {
|
|
|
923
797
|
if (error && error.code && error.code === MethodNotFound) {
|
|
924
798
|
return restoreMethodNotFoundError(error, currentStack);
|
|
925
799
|
}
|
|
800
|
+
if (error && error.error) {
|
|
801
|
+
return restoreJsonRpcError(error.error);
|
|
802
|
+
}
|
|
926
803
|
if (error && error.message) {
|
|
927
804
|
return restoreMessageError(error);
|
|
928
805
|
}
|
|
929
|
-
|
|
930
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
931
|
-
}
|
|
932
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
806
|
+
return new Error(`JsonRpc Error: ${getFallbackMessage(error)}`);
|
|
933
807
|
};
|
|
934
808
|
const unwrapJsonRpcResult = responseMessage => {
|
|
935
809
|
if ('error' in responseMessage) {
|
|
@@ -986,9 +860,9 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
986
860
|
return {
|
|
987
861
|
code: Custom,
|
|
988
862
|
data: {
|
|
989
|
-
code: prettyError.code,
|
|
863
|
+
code: prettyError.code ?? error?.code,
|
|
990
864
|
codeFrame: prettyError.codeFrame,
|
|
991
|
-
name: prettyError.name,
|
|
865
|
+
name: prettyError.name ?? error?.name,
|
|
992
866
|
stack: getStack(prettyError),
|
|
993
867
|
type: getErrorType(prettyError)
|
|
994
868
|
},
|
|
@@ -1023,7 +897,12 @@ const getErrorResponseSimple = (id, error) => {
|
|
|
1023
897
|
return {
|
|
1024
898
|
error: {
|
|
1025
899
|
code: Custom,
|
|
1026
|
-
data: error
|
|
900
|
+
data: error instanceof Error ? {
|
|
901
|
+
...error,
|
|
902
|
+
code: 'code' in error ? error.code : undefined,
|
|
903
|
+
stack: error.stack,
|
|
904
|
+
type: error.name
|
|
905
|
+
} : error,
|
|
1027
906
|
// @ts-ignore
|
|
1028
907
|
message: error.message
|
|
1029
908
|
},
|
|
@@ -1547,22 +1426,22 @@ const exists$4 = async uri => {
|
|
|
1547
1426
|
};
|
|
1548
1427
|
|
|
1549
1428
|
const FileSystemProcess = {
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1429
|
+
__proto__: null,
|
|
1430
|
+
appendFile: appendFile$2,
|
|
1431
|
+
copy: copy$4,
|
|
1432
|
+
exists: exists$4,
|
|
1433
|
+
getFolderSize: getFolderSize$4,
|
|
1434
|
+
getRealPath: getRealPath$4,
|
|
1435
|
+
invoke: invoke$3,
|
|
1436
|
+
mkdir: mkdir$4,
|
|
1437
|
+
readDirWithFileTypes: readDirWithFileTypes$4,
|
|
1438
|
+
readFile: readFile$4,
|
|
1439
|
+
readJson: readJson$4,
|
|
1440
|
+
remove: remove$4,
|
|
1441
|
+
rename: rename$4,
|
|
1442
|
+
set: set$3,
|
|
1443
|
+
stat: stat$4,
|
|
1444
|
+
writeFile: writeFile$4
|
|
1566
1445
|
};
|
|
1567
1446
|
|
|
1568
1447
|
const createLazyRpc = rpcId => {
|
|
@@ -1647,9 +1526,9 @@ const {
|
|
|
1647
1526
|
invokeAndTransfer,
|
|
1648
1527
|
set: set$1
|
|
1649
1528
|
} = create(RendererWorker);
|
|
1650
|
-
const sendMessagePortToRendererProcess = async port => {
|
|
1529
|
+
const sendMessagePortToRendererProcess = async (port, rpcId = DebugWorker) => {
|
|
1651
1530
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1652
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command,
|
|
1531
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, rpcId);
|
|
1653
1532
|
};
|
|
1654
1533
|
const sendMessagePortToFileSystemProcess$1 = async (port, rpcId) => {
|
|
1655
1534
|
const command = 'HandleMessagePortForFileSystemProcess.handleMessagePortForFileSystemProcess';
|
|
@@ -1907,23 +1786,23 @@ const getFiles = async () => {
|
|
|
1907
1786
|
};
|
|
1908
1787
|
|
|
1909
1788
|
const FileSystemMemory = {
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1789
|
+
__proto__: null,
|
|
1790
|
+
copy: copy$2,
|
|
1791
|
+
createFile: createFile$2,
|
|
1792
|
+
exists: exists$2,
|
|
1793
|
+
getFiles,
|
|
1794
|
+
getFolderSize: getFolderSize$2,
|
|
1795
|
+
getPathSeparator: getPathSeparator$1,
|
|
1796
|
+
getRealPath: getRealPath$2,
|
|
1797
|
+
mkdir: mkdir$2,
|
|
1798
|
+
readDirWithFileTypes: readDirWithFileTypes$2,
|
|
1799
|
+
readFile: readFile$2,
|
|
1800
|
+
readFileAsBlob: readFileAsBlob$2,
|
|
1801
|
+
readJson: readJson$2,
|
|
1802
|
+
remove: remove$2,
|
|
1803
|
+
rename: rename$2,
|
|
1804
|
+
stat: stat$2,
|
|
1805
|
+
writeFile: writeFile$2
|
|
1927
1806
|
};
|
|
1928
1807
|
|
|
1929
1808
|
const memoryRoot = id => `memfs:///applications/${encodeURIComponent(id)}`;
|
|
@@ -1949,34 +1828,6 @@ const execute = async (id, method, ...args) => {
|
|
|
1949
1828
|
};
|
|
1950
1829
|
const dispose = async id => remove$2(memoryRoot(id));
|
|
1951
1830
|
|
|
1952
|
-
const normalizeBlobError = error => {
|
|
1953
|
-
const ProgressEventConstructor = ProgressEvent;
|
|
1954
|
-
if (error && ProgressEventConstructor && error instanceof ProgressEventConstructor && error.target &&
|
|
1955
|
-
// @ts-expect-error - target.error may not be in the type definition
|
|
1956
|
-
error.target.error) {
|
|
1957
|
-
// @ts-expect-error - target.error may not be in the type definition
|
|
1958
|
-
return error.target.error;
|
|
1959
|
-
}
|
|
1960
|
-
return error;
|
|
1961
|
-
};
|
|
1962
|
-
|
|
1963
|
-
const binaryStringToBlob = async (string, type) => {
|
|
1964
|
-
try {
|
|
1965
|
-
return binaryStringToBlob$1(string, type);
|
|
1966
|
-
} catch (error) {
|
|
1967
|
-
const normalizedError = normalizeBlobError(error);
|
|
1968
|
-
throw new VError(normalizedError, 'Failed to convert binary string to blob');
|
|
1969
|
-
}
|
|
1970
|
-
};
|
|
1971
|
-
const blobToBinaryString = async blob => {
|
|
1972
|
-
try {
|
|
1973
|
-
return await blobToBinaryString$1(blob);
|
|
1974
|
-
} catch (error) {
|
|
1975
|
-
const normalizedError = normalizeBlobError(error);
|
|
1976
|
-
throw new VError(normalizedError, 'Failed to convert blob to binary string');
|
|
1977
|
-
}
|
|
1978
|
-
};
|
|
1979
|
-
|
|
1980
1831
|
const connect = async port => {
|
|
1981
1832
|
const {
|
|
1982
1833
|
commandMap
|
|
@@ -2047,21 +1898,21 @@ const getFolderSize$1 = async uri => {
|
|
|
2047
1898
|
};
|
|
2048
1899
|
|
|
2049
1900
|
const FileSystemFetch = {
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
1901
|
+
__proto__: null,
|
|
1902
|
+
copy: copy$1,
|
|
1903
|
+
createFile: createFile$1,
|
|
1904
|
+
exists: exists$1,
|
|
1905
|
+
getFolderSize: getFolderSize$1,
|
|
1906
|
+
getRealPath: getRealPath$1,
|
|
1907
|
+
mkdir: mkdir$1,
|
|
1908
|
+
readDirWithFileTypes: readDirWithFileTypes$1,
|
|
1909
|
+
readFile: readFile$1,
|
|
1910
|
+
readFileAsBlob: readFileAsBlob$1,
|
|
1911
|
+
readJson: readJson$1,
|
|
1912
|
+
remove: remove$1,
|
|
1913
|
+
rename: rename$1,
|
|
1914
|
+
stat: stat$1,
|
|
1915
|
+
writeFile: writeFile$1
|
|
2065
1916
|
};
|
|
2066
1917
|
|
|
2067
1918
|
const isFetch = uri => {
|
|
@@ -2181,7 +2032,7 @@ const stat = async dirent => {
|
|
|
2181
2032
|
return stat$3(dirent);
|
|
2182
2033
|
};
|
|
2183
2034
|
const exists = async uri => {
|
|
2184
|
-
if (isFetch(uri) || isHtml(uri)) {
|
|
2035
|
+
if (isFetch(uri) || isHtml(uri) || isProviderUri(uri)) {
|
|
2185
2036
|
return invoke$2('FileSystem.exists', uri);
|
|
2186
2037
|
}
|
|
2187
2038
|
if (isHttp(uri)) {
|
|
@@ -2246,28 +2097,28 @@ const getPathSeparator = async uri => {
|
|
|
2246
2097
|
};
|
|
2247
2098
|
|
|
2248
2099
|
const FileSystemDisk = {
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2100
|
+
__proto__: null,
|
|
2101
|
+
appendFile,
|
|
2102
|
+
copy,
|
|
2103
|
+
createFile,
|
|
2104
|
+
exists,
|
|
2105
|
+
getFileHash,
|
|
2106
|
+
getFileHashes,
|
|
2107
|
+
getFileSize,
|
|
2108
|
+
getFolderSize,
|
|
2109
|
+
getPathSeparator,
|
|
2110
|
+
getRealPath,
|
|
2111
|
+
isReadonly,
|
|
2112
|
+
mkdir,
|
|
2113
|
+
readDirWithFileTypes,
|
|
2114
|
+
readFile,
|
|
2115
|
+
readFileAsBlob,
|
|
2116
|
+
readJson,
|
|
2117
|
+
remove,
|
|
2118
|
+
rename,
|
|
2119
|
+
stat,
|
|
2120
|
+
writeBlob,
|
|
2121
|
+
writeFile
|
|
2271
2122
|
};
|
|
2272
2123
|
|
|
2273
2124
|
const createGlobImplementation = () => {
|
|
@@ -2642,8 +2493,14 @@ const uploadDirectory = async (fileSystemHandle, pathSeparator, root, uploadHand
|
|
|
2642
2493
|
await uploadHandles(childHandles, pathSeparator, folderPath);
|
|
2643
2494
|
};
|
|
2644
2495
|
|
|
2645
|
-
const getBinaryString$1 = file => {
|
|
2646
|
-
|
|
2496
|
+
const getBinaryString$1 = async file => {
|
|
2497
|
+
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
2498
|
+
const chunks = [];
|
|
2499
|
+
const chunkSize = 32_768;
|
|
2500
|
+
for (let i = 0; i < bytes.length; i += chunkSize) {
|
|
2501
|
+
chunks.push(String.fromCodePoint(...bytes.subarray(i, i + chunkSize)));
|
|
2502
|
+
}
|
|
2503
|
+
return chunks.join('');
|
|
2647
2504
|
};
|
|
2648
2505
|
|
|
2649
2506
|
const getFile = handle => {
|
|
@@ -2704,9 +2561,6 @@ const uploadFileSystemHandles = async (root, pathSeparator, fileSystemHandles) =
|
|
|
2704
2561
|
const commandMap = {
|
|
2705
2562
|
'ApplicationFileSystem.dispose': dispose,
|
|
2706
2563
|
'ApplicationFileSystem.execute': execute,
|
|
2707
|
-
'Blob.base64StringToBlob': base64StringToBlob,
|
|
2708
|
-
'Blob.binaryStringToBlob': binaryStringToBlob,
|
|
2709
|
-
'Blob.blobToBinaryString': blobToBinaryString,
|
|
2710
2564
|
'FileSystem.appendFile': appendFile,
|
|
2711
2565
|
'FileSystem.connect': connect,
|
|
2712
2566
|
'FileSystem.copy': copy,
|
|
@@ -2740,8 +2594,8 @@ const commandMap = {
|
|
|
2740
2594
|
};
|
|
2741
2595
|
|
|
2742
2596
|
const CommandMap = {
|
|
2743
|
-
|
|
2744
|
-
|
|
2597
|
+
__proto__: null,
|
|
2598
|
+
commandMap
|
|
2745
2599
|
};
|
|
2746
2600
|
|
|
2747
2601
|
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|