interface.uts 5.2 KB
Newer Older
DCloud-yyl's avatar
DCloud-yyl 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
export type SaveFileSuccess = {
    savedFilePath: string;
};
export type SaveFileSuccessCallback = (res: SaveFileSuccess) => void;
export type SaveFileFail = {};
export type SaveFileFailCallback = (res: SaveFileFail) => void;
export type SaveFileCompleteCallback = (res: any) => void;
export type SaveFileOptions = {
    tempFilePath: string;
    success?: SaveFileSuccessCallback | null;
    fail?: SaveFileFailCallback | null;
    complete?: SaveFileCompleteCallback | null;
};

export type GetFileInfoSuccess = {
    digest: string;
    size: number;
};
export type GetFileInfoSuccessCallback = (res: GetFileInfoSuccess) => void;
export type GetFileInfoFail = {};
export type GetFileInfoFailCallback = (res: GetFileInfoFail) => void;
export type GetFileInfoCompleteCallback = (res: any) => void;
export type GetFileInfoOptions = {
    filePath: string;
    digestAlgorithm?: string | null;
    success?: GetFileInfoSuccessCallback | null;
    fail?: GetFileInfoFailCallback | null;
    complete?: GetFileInfoCompleteCallback | null;
};

export type GetSavedFileInfoSuccess = {
    size: number;
    createTime: number;
};
export type GetSavedFileInfoSuccessCallback = (res: GetSavedFileInfoSuccess) => void;
export type GetSavedFileInfoFail = {};
export type GetSavedFileInfoFailCallback = (res: GetSavedFileInfoFail) => void;
export type GetSavedFileInfoCompleteCallback = (res: any) => void;
export type GetSavedFileInfoOptions = {
    filePath: string;
    success?: GetSavedFileInfoSuccessCallback | null;
    fail?: GetSavedFileInfoFailCallback | null;
    complete?: GetSavedFileInfoCompleteCallback | null;
};

export type RemoveSavedFileSuccess = {};
export type RemoveSavedFileSuccessCallback = (res: RemoveSavedFileSuccess) => void;
export type RemoveSavedFileFail = {};
export type RemoveSavedFileFailCallback = (res: RemoveSavedFileFail) => void;
export type RemoveSavedFileCompleteCallback = (res: any) => void;
export type RemoveSavedFileOptions = {
    filePath: string;
    success?: RemoveSavedFileSuccessCallback | null;
    fail?: RemoveSavedFileFailCallback | null;
    complete?: RemoveSavedFileCompleteCallback | null;
};

export type SavedFileListItem = {
    filePath: string;
    size: number;
    createTime: number;
};
export type GetSavedFileListSuccess = {
    fileList: SavedFileListItem[];
};
export type GetSavedFileListSuccessCallback = (res: GetSavedFileListSuccess) => void;
export type GetSavedFileListFail = {};
export type GetSavedFileListFailCallback = (res: GetSavedFileListFail) => void;
export type GetSavedFileListCompleteCallback = (res: any) => void;
export type GetSavedFileListOptions = {
    success?: GetSavedFileListSuccessCallback | null;
    fail?: GetSavedFileListFailCallback | null;
    complete?: GetSavedFileListCompleteCallback | null;
};

export type SaveFile = (options?: SaveFileOptions | null) => void;
export type GetFileInfo = (options?: GetFileInfoOptions | null) => void;
export type GetSavedFileInfo = (options?: GetSavedFileInfoOptions | null) => void;
export type RemoveSavedFile = (options?: RemoveSavedFileOptions | null) => void;
export type GetSavedFileList = (options?: GetSavedFileListOptions | null) => void;


export interface Uni {
    /**
     * 保存文件
     * @uniPlatform {
     *    "app": {
     *      "harmony": {
     *        "osVer": "3.0",
     *        "uniVer": "4.25",
     *        "unixVer": "x"
     *      }
     *  },
     *  "web": {
     *    "uniVer": "x",
     *    "unixVer": "x"
     *  }
     * }
     * @uniVueVersion 2,3  //支持的vue版本
     */
    saveFile(options?: SaveFileOptions | null): void;
    /**
     * 获取本地已保存的文件列表
     * @uniPlatform {
     *    "app": {
     *      "harmony": {
     *        "osVer": "3.0",
     *        "uniVer": "4.25",
     *        "unixVer": "x"
     *      }
     *  },
     *  "web": {
     *    "uniVer": "x",
     *    "unixVer": "x"
     *  }
     * }
     * @uniVueVersion 2,3  //支持的vue版本
     */
    getSavedFileList(options?: GetSavedFileListOptions | null): void;
    /**
     * 获取已保存到本地的文件信息
     * @uniPlatform {
     *    "app": {
     *      "harmony": {
     *        "osVer": "3.0",
     *        "uniVer": "4.25",
     *        "unixVer": "x"
     *      }
     *  },
     *  "web": {
     *    "uniVer": "x",
     *    "unixVer": "x"
     *  }
     * }
     * @uniVueVersion 2,3  //支持的vue版本
     */
    getSavedFileInfo(options?: GetSavedFileInfoOptions | null): void;
    /**
     * 删除已保存的文件
     * @uniPlatform {
     *    "app": {
     *      "harmony": {
     *        "osVer": "3.0",
     *        "uniVer": "4.25",
     *        "unixVer": "x"
     *      }
     *  },
     *  "web": {
     *    "uniVer": "x",
     *    "unixVer": "x"
     *  }
     * }
     * @uniVueVersion 2,3  //支持的vue版本
     */
    removeSavedFile(options?: RemoveSavedFileOptions | null): void;
    /**
     * 获取文件信息
     * @uniPlatform {
     *    "app": {
     *      "harmony": {
     *        "osVer": "3.0",
     *        "uniVer": "4.25",
     *        "unixVer": "x"
     *      }
     *  },
     *  "web": {
     *    "uniVer": "x",
     *    "unixVer": "x"
     *  }
     * }
     * @uniVueVersion 2,3  //支持的vue版本
     */
    getFileInfo(options?: GetFileInfoOptions | null): void;
}