@lvce-editor/file-system-worker 3.0.0 → 3.1.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/dist/fileSystemWorkerMain.js +10 -2
- package/package.json +1 -1
|
@@ -1860,10 +1860,18 @@ const writeFile = async (uri, content) => {
|
|
|
1860
1860
|
}
|
|
1861
1861
|
return writeFile$2(uri, content);
|
|
1862
1862
|
};
|
|
1863
|
-
const
|
|
1863
|
+
const getBytes = async blob => {
|
|
1864
|
+
if (blob.bytes) {
|
|
1865
|
+
return blob.bytes();
|
|
1866
|
+
}
|
|
1864
1867
|
const buffer = await blob.arrayBuffer();
|
|
1868
|
+
const bytes = new Uint8Array(buffer);
|
|
1869
|
+
return bytes;
|
|
1870
|
+
};
|
|
1871
|
+
const writeBlob = async (uri, blob) => {
|
|
1872
|
+
const bytes = await getBytes(blob);
|
|
1865
1873
|
// @ts-ignore
|
|
1866
|
-
await invoke('FileSystem.writeBuffer', uri,
|
|
1874
|
+
await invoke('FileSystem.writeBuffer', uri, bytes);
|
|
1867
1875
|
};
|
|
1868
1876
|
const mkdir = async uri => {
|
|
1869
1877
|
return mkdir$1(uri);
|