@widget-js/core 0.11.9 → 0.11.12
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/index.cjs +19 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +25 -5
- package/dist/index.js +19 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1577,22 +1577,42 @@ interface SystemFile {
|
|
|
1577
1577
|
*/
|
|
1578
1578
|
type: string;
|
|
1579
1579
|
children?: SystemFile[];
|
|
1580
|
+
}
|
|
1581
|
+
interface FileInfo {
|
|
1582
|
+
isDir: boolean;
|
|
1583
|
+
name: string;
|
|
1584
|
+
absolutePath: string;
|
|
1585
|
+
/**
|
|
1586
|
+
* mine类型
|
|
1587
|
+
*/
|
|
1588
|
+
type?: string;
|
|
1580
1589
|
/**
|
|
1581
|
-
*
|
|
1590
|
+
* 格式
|
|
1582
1591
|
*/
|
|
1583
|
-
|
|
1592
|
+
extension?: string;
|
|
1584
1593
|
}
|
|
1585
1594
|
interface ReadDirOptions {
|
|
1586
1595
|
ignoreDir?: boolean;
|
|
1587
1596
|
traverseDir?: boolean;
|
|
1588
1597
|
}
|
|
1598
|
+
interface DownloadUrlOptions {
|
|
1599
|
+
url: string;
|
|
1600
|
+
savePath: string;
|
|
1601
|
+
fileName: string;
|
|
1602
|
+
/**
|
|
1603
|
+
* true - overwrite existing
|
|
1604
|
+
* false - ignore
|
|
1605
|
+
*/
|
|
1606
|
+
overwrite?: boolean;
|
|
1607
|
+
}
|
|
1589
1608
|
interface IFileApi {
|
|
1590
1609
|
readDirectory(path: string, options?: ReadDirOptions): Promise<SystemFile[]>;
|
|
1591
1610
|
isDirectory(filePath: string): Promise<boolean>;
|
|
1592
|
-
|
|
1593
|
-
downloadUrl(
|
|
1611
|
+
getMimeType(absoluteFilePath: string): Promise<FileTypeResult>;
|
|
1612
|
+
downloadUrl(option: DownloadUrlOptions): Promise<string>;
|
|
1594
1613
|
exists(filePath: string): Promise<boolean>;
|
|
1595
1614
|
delete(filePath: string): Promise<boolean>;
|
|
1615
|
+
getInfo(absoluteFilePath: string): Promise<FileInfo>;
|
|
1596
1616
|
/**
|
|
1597
1617
|
* @param childPath
|
|
1598
1618
|
* @example childPath = "/images/" will return "C:/Users/username/Documents/widgets/com/exmaple/widget/images"
|
|
@@ -1621,4 +1641,4 @@ interface IFileApi {
|
|
|
1621
1641
|
type FileApiMethods = keyof IFileApi;
|
|
1622
1642
|
declare const FileApi: IFileApi;
|
|
1623
1643
|
|
|
1624
|
-
export { AlignPosition, ApiConstants, AppApi, AppApiConstants, AppApiEvent, AppApiMethods, AppMouseEvent, AppNotification, BaseApi, BroadcastApi, BroadcastApiMethods, BroadcastEvent, BroadcastEventType, BrowserWindowApi, BrowserWindowApiEvent, BrowserWindowApiMethods, Channel, ClipboardApi, ClipboardApiEvent, ClipboardApiMethods, DeployMode, DeployedPage, DeployedWidget, DeployedWidgetApi, DeployedWidgetApiMethods, DevOptions, DeviceApi, DeviceApiMethods, DialogApi, DialogApiMethods, ElectronApi, ElectronUtils, FileApi, FileApiMethods, Gravity, GridRect, GridSystem, HostedMode, IGridRect, IPage, IPageOptions, IWidgetDataApi, IWidgetOptions, IWindowSize, LanguageCode, LanguageTextMap, LocalPackageUrlInfo, LocationQuery, LocationQueryRaw, LocationQueryValue, LocationQueryValueRaw, LogApi, LogApiMethods, MetaInfo, Metadata, NativeKeyboardEvent, NormalizeOptions, NotificationApi, NotificationApiEvent, NotificationApiMethods, NotificationOption, NotificationSize, NotificationType, OpenUrlOptions, Page, Point, Position, ProcessApi, ProcessApiMethods, ReadDirOptions, Rectangle, RemotePackageUrlInfo, SaveWidgetOption, SetPositionOptions, ShortcutApi, ShortcutApiEvent, ShortcutApiMethods, StoreApi, StoreApiMethods, SystemFile, ThemeMode, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetApiMethods, WidgetData, WidgetDataApi, WidgetDataApiMethods, WidgetKeyword, WidgetPackage, WidgetPackageOptions, WidgetParams, WidgetPermission, WidgetRoute, WidgetUrlUtils, getTextByLanguageCode, normalizeUrl, parseQuery, stringifyQuery };
|
|
1644
|
+
export { AlignPosition, ApiConstants, AppApi, AppApiConstants, AppApiEvent, AppApiMethods, AppMouseEvent, AppNotification, BaseApi, BroadcastApi, BroadcastApiMethods, BroadcastEvent, BroadcastEventType, BrowserWindowApi, BrowserWindowApiEvent, BrowserWindowApiMethods, Channel, ClipboardApi, ClipboardApiEvent, ClipboardApiMethods, DeployMode, DeployedPage, DeployedWidget, DeployedWidgetApi, DeployedWidgetApiMethods, DevOptions, DeviceApi, DeviceApiMethods, DialogApi, DialogApiMethods, DownloadUrlOptions, ElectronApi, ElectronUtils, FileApi, FileApiMethods, FileInfo, Gravity, GridRect, GridSystem, HostedMode, IGridRect, IPage, IPageOptions, IWidgetDataApi, IWidgetOptions, IWindowSize, LanguageCode, LanguageTextMap, LocalPackageUrlInfo, LocationQuery, LocationQueryRaw, LocationQueryValue, LocationQueryValueRaw, LogApi, LogApiMethods, MetaInfo, Metadata, NativeKeyboardEvent, NormalizeOptions, NotificationApi, NotificationApiEvent, NotificationApiMethods, NotificationOption, NotificationSize, NotificationType, OpenUrlOptions, Page, Point, Position, ProcessApi, ProcessApiMethods, ReadDirOptions, Rectangle, RemotePackageUrlInfo, SaveWidgetOption, SetPositionOptions, ShortcutApi, ShortcutApiEvent, ShortcutApiMethods, StoreApi, StoreApiMethods, SystemFile, ThemeMode, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetApiMethods, WidgetData, WidgetDataApi, WidgetDataApiMethods, WidgetKeyword, WidgetPackage, WidgetPackageOptions, WidgetParams, WidgetPermission, WidgetRoute, WidgetUrlUtils, getTextByLanguageCode, normalizeUrl, parseQuery, stringifyQuery };
|
package/dist/index.js
CHANGED
|
@@ -2019,39 +2019,45 @@ var LogApi = new LogApiImpl();
|
|
|
2019
2019
|
|
|
2020
2020
|
// src/api/FileApi.ts
|
|
2021
2021
|
var FileApiImpl = class extends BaseApi {
|
|
2022
|
-
|
|
2022
|
+
async delete(filePath) {
|
|
2023
|
+
return this.invokeMethod("delete", filePath);
|
|
2024
|
+
}
|
|
2025
|
+
async getPictureMetadata(filePath) {
|
|
2023
2026
|
return this.invokeMethod("getPictureMetadata", filePath);
|
|
2024
2027
|
}
|
|
2025
|
-
move(form, to) {
|
|
2028
|
+
async move(form, to) {
|
|
2026
2029
|
return this.invokeMethod("move", form, to);
|
|
2027
2030
|
}
|
|
2028
|
-
|
|
2029
|
-
return this.invokeMethod("getFileType", filePath);
|
|
2030
|
-
}
|
|
2031
|
-
isDirectory(filePath) {
|
|
2031
|
+
async isDirectory(filePath) {
|
|
2032
2032
|
return this.invokeMethod("isDirectory", filePath);
|
|
2033
2033
|
}
|
|
2034
2034
|
getChannel() {
|
|
2035
2035
|
return "channel::cn.widgetjs.core.file" /* FILE */;
|
|
2036
2036
|
}
|
|
2037
|
-
readDirectory(path, options) {
|
|
2037
|
+
async readDirectory(path, options) {
|
|
2038
2038
|
return this.invokeMethod("readDirectory", path, options);
|
|
2039
2039
|
}
|
|
2040
|
-
|
|
2040
|
+
asyncdelete(filePath) {
|
|
2041
2041
|
return this.invokeMethod("delete", filePath);
|
|
2042
2042
|
}
|
|
2043
|
-
downloadUrl(
|
|
2044
|
-
return this.invokeMethod("downloadUrl",
|
|
2043
|
+
async downloadUrl(options) {
|
|
2044
|
+
return this.invokeMethod("downloadUrl", options);
|
|
2045
2045
|
}
|
|
2046
|
-
exists(filePath) {
|
|
2046
|
+
async exists(filePath) {
|
|
2047
2047
|
return this.invokeMethod("exists", filePath);
|
|
2048
2048
|
}
|
|
2049
|
-
readFile(filePath) {
|
|
2049
|
+
async readFile(filePath) {
|
|
2050
2050
|
return this.invokeMethod("readFile", filePath);
|
|
2051
2051
|
}
|
|
2052
|
-
getDocumentFolder(filePath) {
|
|
2052
|
+
async getDocumentFolder(filePath) {
|
|
2053
2053
|
return this.invokeMethod("getDocumentFolder", filePath);
|
|
2054
2054
|
}
|
|
2055
|
+
async getMimeType(absoluteFilePath) {
|
|
2056
|
+
return this.invokeMethod("getMimeType", absoluteFilePath);
|
|
2057
|
+
}
|
|
2058
|
+
async getInfo(absoluteFilePath) {
|
|
2059
|
+
return this.invokeMethod("getInfo", absoluteFilePath);
|
|
2060
|
+
}
|
|
2055
2061
|
};
|
|
2056
2062
|
var FileApi = new FileApiImpl();
|
|
2057
2063
|
export {
|