web.d.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import { WebPlugin } from '@capacitor/core';
  2. import type { AppendFileOptions, CopyOptions, CopyResult, DeleteFileOptions, FilesystemPlugin, GetUriOptions, GetUriResult, MkdirOptions, PermissionStatus, ReadFileOptions, ReadFileResult, ReaddirOptions, ReaddirResult, RenameOptions, RmdirOptions, StatOptions, StatResult, WriteFileOptions, WriteFileResult, ReadFileInChunksOptions, CallbackID, DownloadFileOptions, DownloadFileResult, ReadFileInChunksCallback } from './definitions';
  3. export declare class FilesystemWeb extends WebPlugin implements FilesystemPlugin {
  4. readFileInChunks(_options: ReadFileInChunksOptions, _callback: ReadFileInChunksCallback): Promise<CallbackID>;
  5. DB_VERSION: number;
  6. DB_NAME: string;
  7. private _writeCmds;
  8. private _db?;
  9. static _debug: boolean;
  10. initDb(): Promise<IDBDatabase>;
  11. static doUpgrade(event: IDBVersionChangeEvent): void;
  12. dbRequest(cmd: string, args: any[]): Promise<any>;
  13. dbIndexRequest(indexName: string, cmd: string, args: [any]): Promise<any>;
  14. private getPath;
  15. clear(): Promise<void>;
  16. /**
  17. * Read a file from disk
  18. * @param options options for the file read
  19. * @return a promise that resolves with the read file data result
  20. */
  21. readFile(options: ReadFileOptions): Promise<ReadFileResult>;
  22. /**
  23. * Write a file to disk in the specified location on device
  24. * @param options options for the file write
  25. * @return a promise that resolves with the file write result
  26. */
  27. writeFile(options: WriteFileOptions): Promise<WriteFileResult>;
  28. /**
  29. * Append to a file on disk in the specified location on device
  30. * @param options options for the file append
  31. * @return a promise that resolves with the file write result
  32. */
  33. appendFile(options: AppendFileOptions): Promise<void>;
  34. /**
  35. * Delete a file from disk
  36. * @param options options for the file delete
  37. * @return a promise that resolves with the deleted file data result
  38. */
  39. deleteFile(options: DeleteFileOptions): Promise<void>;
  40. /**
  41. * Create a directory.
  42. * @param options options for the mkdir
  43. * @return a promise that resolves with the mkdir result
  44. */
  45. mkdir(options: MkdirOptions): Promise<void>;
  46. /**
  47. * Remove a directory
  48. * @param options the options for the directory remove
  49. */
  50. rmdir(options: RmdirOptions): Promise<void>;
  51. /**
  52. * Return a list of files from the directory (not recursive)
  53. * @param options the options for the readdir operation
  54. * @return a promise that resolves with the readdir directory listing result
  55. */
  56. readdir(options: ReaddirOptions): Promise<ReaddirResult>;
  57. /**
  58. * Return full File URI for a path and directory
  59. * @param options the options for the stat operation
  60. * @return a promise that resolves with the file stat result
  61. */
  62. getUri(options: GetUriOptions): Promise<GetUriResult>;
  63. /**
  64. * Return data about a file
  65. * @param options the options for the stat operation
  66. * @return a promise that resolves with the file stat result
  67. */
  68. stat(options: StatOptions): Promise<StatResult>;
  69. /**
  70. * Rename a file or directory
  71. * @param options the options for the rename operation
  72. * @return a promise that resolves with the rename result
  73. */
  74. rename(options: RenameOptions): Promise<void>;
  75. /**
  76. * Copy a file or directory
  77. * @param options the options for the copy operation
  78. * @return a promise that resolves with the copy result
  79. */
  80. copy(options: CopyOptions): Promise<CopyResult>;
  81. requestPermissions(): Promise<PermissionStatus>;
  82. checkPermissions(): Promise<PermissionStatus>;
  83. /**
  84. * Function that can perform a copy or a rename
  85. * @param options the options for the rename operation
  86. * @param doRename whether to perform a rename or copy operation
  87. * @return a promise that resolves with the result
  88. */
  89. private _copy;
  90. /**
  91. * Function that performs a http request to a server and downloads the file to the specified destination
  92. *
  93. * @deprecated Use the @capacitor/file-transfer plugin instead.
  94. * @param options the options for the download operation
  95. * @returns a promise that resolves with the download file result
  96. */
  97. downloadFile: (options: DownloadFileOptions) => Promise<DownloadFileResult>;
  98. private isBase64String;
  99. }