@lvce-editor/file-search-worker 2.0.0 → 2.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/fileSearchWorkerMain.js +16 -16
- package/package.json +1 -1
|
@@ -924,6 +924,17 @@ class FileNotFoundError extends Error {
|
|
|
924
924
|
}
|
|
925
925
|
}
|
|
926
926
|
|
|
927
|
+
const getContentType = uri => {
|
|
928
|
+
if (uri.endsWith('.png')) {
|
|
929
|
+
return 'image/png';
|
|
930
|
+
}
|
|
931
|
+
if (uri.endsWith('.svg')) {
|
|
932
|
+
return 'image/svg+xml';
|
|
933
|
+
}
|
|
934
|
+
// TODO support more
|
|
935
|
+
return '';
|
|
936
|
+
};
|
|
937
|
+
|
|
927
938
|
// TODO move this to an extension?
|
|
928
939
|
|
|
929
940
|
const state$2 = {
|
|
@@ -1019,30 +1030,19 @@ const readDirWithFileTypes = uri => {
|
|
|
1019
1030
|
}
|
|
1020
1031
|
return dirents;
|
|
1021
1032
|
};
|
|
1022
|
-
const
|
|
1023
|
-
if (uri.endsWith('.png')) {
|
|
1024
|
-
return 'image/png';
|
|
1025
|
-
}
|
|
1026
|
-
if (uri.endsWith('.svg')) {
|
|
1027
|
-
return 'image/svg+xml';
|
|
1028
|
-
}
|
|
1029
|
-
// TODO support more
|
|
1030
|
-
return '';
|
|
1031
|
-
};
|
|
1032
|
-
const getBlobUrl = uri => {
|
|
1033
|
+
const getBlob = uri => {
|
|
1033
1034
|
const content = readFile(uri);
|
|
1034
1035
|
const contentType = getContentType(uri);
|
|
1035
1036
|
const blob = new Blob([content], {
|
|
1036
1037
|
type: contentType
|
|
1037
1038
|
});
|
|
1039
|
+
return blob;
|
|
1040
|
+
};
|
|
1041
|
+
const getBlobUrl = uri => {
|
|
1042
|
+
const blob = getBlob(uri);
|
|
1038
1043
|
const url = URL.createObjectURL(blob);
|
|
1039
1044
|
return url;
|
|
1040
1045
|
};
|
|
1041
|
-
const getBlob = uri => {
|
|
1042
|
-
const content = readFile(uri);
|
|
1043
|
-
const blob = new Blob([content]);
|
|
1044
|
-
return blob;
|
|
1045
|
-
};
|
|
1046
1046
|
const chmod = () => {
|
|
1047
1047
|
throw new Error('[memfs] chmod not implemented');
|
|
1048
1048
|
};
|