@capacitor/filesystem 7.0.2-nightly-20250523T150554.0 → 7.1.0-dev.1

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.
Files changed (39) hide show
  1. package/CapacitorFilesystem.podspec +4 -3
  2. package/Package.swift +10 -4
  3. package/README.md +149 -78
  4. package/android/build.gradle +12 -22
  5. package/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemErrors.kt +101 -0
  6. package/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemMethodOptions.kt +129 -0
  7. package/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemMethodResults.kt +65 -0
  8. package/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemPlugin.kt +412 -0
  9. package/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/LegacyFilesystemImplementation.kt +169 -0
  10. package/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/PluginResultExtensions.kt +25 -0
  11. package/dist/docs.json +227 -145
  12. package/dist/esm/definitions.d.ts +102 -64
  13. package/dist/esm/definitions.js +25 -3
  14. package/dist/esm/definitions.js.map +1 -1
  15. package/dist/esm/index.js +3 -1
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/web.d.ts +3 -1
  18. package/dist/esm/web.js +10 -10
  19. package/dist/esm/web.js.map +1 -1
  20. package/dist/plugin.cjs.js +40 -14
  21. package/dist/plugin.cjs.js.map +1 -1
  22. package/dist/plugin.js +41 -16
  23. package/dist/plugin.js.map +1 -1
  24. package/ios/Sources/FilesystemPlugin/CAPPluginCall+Accelerators.swift +73 -0
  25. package/ios/Sources/FilesystemPlugin/FilesystemConstants.swift +61 -0
  26. package/ios/Sources/FilesystemPlugin/FilesystemError.swift +57 -0
  27. package/ios/Sources/FilesystemPlugin/FilesystemLocationResolver.swift +39 -0
  28. package/ios/Sources/FilesystemPlugin/FilesystemOperation.swift +24 -0
  29. package/ios/Sources/FilesystemPlugin/FilesystemOperationExecutor.swift +116 -0
  30. package/ios/Sources/FilesystemPlugin/FilesystemPlugin.swift +103 -264
  31. package/ios/Sources/FilesystemPlugin/IONFileStructures+Converters.swift +60 -0
  32. package/ios/Sources/FilesystemPlugin/{Filesystem.swift → LegacyFilesystemImplementation.swift} +18 -179
  33. package/package.json +28 -24
  34. package/LICENSE +0 -23
  35. package/android/src/main/java/com/capacitorjs/plugins/filesystem/Filesystem.java +0 -414
  36. package/android/src/main/java/com/capacitorjs/plugins/filesystem/FilesystemPlugin.java +0 -551
  37. package/android/src/main/java/com/capacitorjs/plugins/filesystem/exceptions/CopyFailedException.java +0 -16
  38. package/android/src/main/java/com/capacitorjs/plugins/filesystem/exceptions/DirectoryExistsException.java +0 -16
  39. package/android/src/main/java/com/capacitorjs/plugins/filesystem/exceptions/DirectoryNotFoundException.java +0 -16
package/dist/plugin.js CHANGED
@@ -1,4 +1,4 @@
1
- var capacitorFilesystem = (function (exports, core) {
1
+ var capacitorFilesystemPluginCapacitor = (function (exports, core, synapse) {
2
2
  'use strict';
3
3
 
4
4
  exports.Directory = void 0;
@@ -8,7 +8,7 @@ var capacitorFilesystem = (function (exports, core) {
8
8
  * On iOS it's the app's documents directory.
9
9
  * Use this directory to store user-generated content.
10
10
  * On Android it's the Public Documents folder, so it's accessible from other apps.
11
- * It's not accesible on Android 10 unless the app enables legacy External Storage
11
+ * It's not accessible on Android 10 unless the app enables legacy External Storage
12
12
  * by adding `android:requestLegacyExternalStorage="true"` in the `application` tag
13
13
  * in the `AndroidManifest.xml`.
14
14
  * On Android 11 or newer the app can only access the files/folders the app created.
@@ -58,14 +58,36 @@ var capacitorFilesystem = (function (exports, core) {
58
58
  * The external storage directory.
59
59
  * On iOS it will use the Documents directory.
60
60
  * On Android it's the primary shared/external storage directory.
61
- * It's not accesible on Android 10 unless the app enables legacy External Storage
61
+ * It's not accessible on Android 10 unless the app enables legacy External Storage
62
62
  * by adding `android:requestLegacyExternalStorage="true"` in the `application` tag
63
63
  * in the `AndroidManifest.xml`.
64
- * It's not accesible on Android 11 or newer.
64
+ * It's not accessible on Android 11 or newer.
65
65
  *
66
66
  * @since 1.0.0
67
67
  */
68
68
  Directory["ExternalStorage"] = "EXTERNAL_STORAGE";
69
+ /**
70
+ * The external cache directory.
71
+ * On iOS it will use the Documents directory.
72
+ * On Android it's the primary shared/external cache.
73
+ *
74
+ * @since 7.1.0
75
+ */
76
+ Directory["ExternalCache"] = "EXTERNAL_CACHE";
77
+ /**
78
+ * The Library directory without cloud backup. Used in iOS.
79
+ * On Android it's the directory holding application files.
80
+ *
81
+ * @since 7.1.0
82
+ */
83
+ Directory["LibraryNoCloud"] = "LIBRARY_NO_CLOUD";
84
+ /**
85
+ * A temporary directory for iOS.
86
+ * On Android it's the directory holding the application cache.
87
+ *
88
+ * @since 7.1.0
89
+ */
90
+ Directory["Temporary"] = "TEMPORARY";
69
91
  })(exports.Directory || (exports.Directory = {}));
70
92
  exports.Encoding = void 0;
71
93
  (function (Encoding) {
@@ -104,16 +126,15 @@ var capacitorFilesystem = (function (exports, core) {
104
126
  const FilesystemEncoding = exports.Encoding;
105
127
 
106
128
  const Filesystem = core.registerPlugin('Filesystem', {
107
- web: () => Promise.resolve().then(function () { return web; }).then(m => new m.FilesystemWeb()),
129
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.FilesystemWeb()),
108
130
  });
131
+ synapse.exposeSynapse();
109
132
 
110
133
  function resolve(path) {
111
- const posix = path.split('/').filter(item => item !== '.');
134
+ const posix = path.split('/').filter((item) => item !== '.');
112
135
  const newPosix = [];
113
- posix.forEach(item => {
114
- if (item === '..' &&
115
- newPosix.length > 0 &&
116
- newPosix[newPosix.length - 1] !== '..') {
136
+ posix.forEach((item) => {
137
+ if (item === '..' && newPosix.length > 0 && newPosix[newPosix.length - 1] !== '..') {
117
138
  newPosix.pop();
118
139
  }
119
140
  else {
@@ -127,8 +148,7 @@ var capacitorFilesystem = (function (exports, core) {
127
148
  children = resolve(children);
128
149
  const pathsA = parent.split('/');
129
150
  const pathsB = children.split('/');
130
- return (parent !== children &&
131
- pathsA.every((value, index) => value === pathsB[index]));
151
+ return parent !== children && pathsA.every((value, index) => value === pathsB[index]);
132
152
  }
133
153
  class FilesystemWeb extends core.WebPlugin {
134
154
  constructor() {
@@ -139,6 +159,7 @@ var capacitorFilesystem = (function (exports, core) {
139
159
  /**
140
160
  * Function that performs a http request to a server and downloads the file to the specified destination
141
161
  *
162
+ * @deprecated Use the @capacitor/file-transfer plugin instead.
142
163
  * @param options the options for the download operation
143
164
  * @returns a promise that resolves with the download file result
144
165
  */
@@ -189,6 +210,9 @@ var capacitorFilesystem = (function (exports, core) {
189
210
  return { path: result.uri, blob };
190
211
  };
191
212
  }
213
+ readFileInChunks(_options, _callback) {
214
+ throw this.unavailable('Method not implemented.');
215
+ }
192
216
  async initDb() {
193
217
  if (this._db !== undefined) {
194
218
  return this._db;
@@ -385,9 +409,7 @@ var capacitorFilesystem = (function (exports, core) {
385
409
  const entry = (await this.dbRequest('get', [path]));
386
410
  if (entry === undefined)
387
411
  throw Error('File does not exist.');
388
- const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [
389
- IDBKeyRange.only(path),
390
- ]);
412
+ const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [IDBKeyRange.only(path)]);
391
413
  if (entries.length !== 0)
392
414
  throw Error('Folder is not empty.');
393
415
  await this.dbRequest('delete', [path]);
@@ -512,6 +534,7 @@ var capacitorFilesystem = (function (exports, core) {
512
534
  if (entry === undefined)
513
535
  throw Error('Entry does not exist.');
514
536
  return {
537
+ name: entry.path.substring(path.length + 1),
515
538
  type: entry.type,
516
539
  size: entry.size,
517
540
  ctime: entry.ctime,
@@ -710,7 +733,9 @@ var capacitorFilesystem = (function (exports, core) {
710
733
  exports.FilesystemDirectory = FilesystemDirectory;
711
734
  exports.FilesystemEncoding = FilesystemEncoding;
712
735
 
736
+ Object.defineProperty(exports, '__esModule', { value: true });
737
+
713
738
  return exports;
714
739
 
715
- })({}, capacitorExports);
740
+ })({}, capacitorExports, synapse);
716
741
  //# sourceMappingURL=plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var Directory;\n(function (Directory) {\n /**\n * The Documents directory.\n * On iOS it's the app's documents directory.\n * Use this directory to store user-generated content.\n * On Android it's the Public Documents folder, so it's accessible from other apps.\n * It's not accesible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * On Android 11 or newer the app can only access the files/folders the app created.\n *\n * @since 1.0.0\n */\n Directory[\"Documents\"] = \"DOCUMENTS\";\n /**\n * The Data directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n Directory[\"Data\"] = \"DATA\";\n /**\n * The Library directory.\n * On iOS it will use the Library directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.1.0\n */\n Directory[\"Library\"] = \"LIBRARY\";\n /**\n * The Cache directory.\n * Can be deleted in cases of low memory, so use this directory to write app-specific files.\n * that your app can re-create easily.\n *\n * @since 1.0.0\n */\n Directory[\"Cache\"] = \"CACHE\";\n /**\n * The external directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory on the primary shared/external\n * storage device where the application can place persistent files it owns.\n * These files are internal to the applications, and not typically visible\n * to the user as media.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n Directory[\"External\"] = \"EXTERNAL\";\n /**\n * The external storage directory.\n * On iOS it will use the Documents directory.\n * On Android it's the primary shared/external storage directory.\n * It's not accesible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * It's not accesible on Android 11 or newer.\n *\n * @since 1.0.0\n */\n Directory[\"ExternalStorage\"] = \"EXTERNAL_STORAGE\";\n})(Directory || (Directory = {}));\nexport var Encoding;\n(function (Encoding) {\n /**\n * Eight-bit UCS Transformation Format\n *\n * @since 1.0.0\n */\n Encoding[\"UTF8\"] = \"utf8\";\n /**\n * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the\n * Unicode character set\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n Encoding[\"ASCII\"] = \"ascii\";\n /**\n * Sixteen-bit UCS Transformation Format, byte order identified by an\n * optional byte-order mark\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n Encoding[\"UTF16\"] = \"utf16\";\n})(Encoding || (Encoding = {}));\n/**\n * @deprecated Use `Directory`.\n * @since 1.0.0\n */\nexport const FilesystemDirectory = Directory;\n/**\n * @deprecated Use `Encoding`.\n * @since 1.0.0\n */\nexport const FilesystemEncoding = Encoding;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Filesystem = registerPlugin('Filesystem', {\n web: () => import('./web').then(m => new m.FilesystemWeb()),\n});\nexport * from './definitions';\nexport { Filesystem };\n//# sourceMappingURL=index.js.map","import { WebPlugin, buildRequestInit } from '@capacitor/core';\nimport { Encoding } from './definitions';\nfunction resolve(path) {\n const posix = path.split('/').filter(item => item !== '.');\n const newPosix = [];\n posix.forEach(item => {\n if (item === '..' &&\n newPosix.length > 0 &&\n newPosix[newPosix.length - 1] !== '..') {\n newPosix.pop();\n }\n else {\n newPosix.push(item);\n }\n });\n return newPosix.join('/');\n}\nfunction isPathParent(parent, children) {\n parent = resolve(parent);\n children = resolve(children);\n const pathsA = parent.split('/');\n const pathsB = children.split('/');\n return (parent !== children &&\n pathsA.every((value, index) => value === pathsB[index]));\n}\nexport class FilesystemWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.DB_VERSION = 1;\n this.DB_NAME = 'Disc';\n this._writeCmds = ['add', 'put', 'delete'];\n /**\n * Function that performs a http request to a server and downloads the file to the specified destination\n *\n * @param options the options for the download operation\n * @returns a promise that resolves with the download file result\n */\n this.downloadFile = async (options) => {\n var _a, _b;\n const requestInit = buildRequestInit(options, options.webFetchExtra);\n const response = await fetch(options.url, requestInit);\n let blob;\n if (!options.progress)\n blob = await response.blob();\n else if (!(response === null || response === void 0 ? void 0 : response.body))\n blob = new Blob();\n else {\n const reader = response.body.getReader();\n let bytes = 0;\n const chunks = [];\n const contentType = response.headers.get('content-type');\n const contentLength = parseInt(response.headers.get('content-length') || '0', 10);\n while (true) {\n const { done, value } = await reader.read();\n if (done)\n break;\n chunks.push(value);\n bytes += (value === null || value === void 0 ? void 0 : value.length) || 0;\n const status = {\n url: options.url,\n bytes,\n contentLength,\n };\n this.notifyListeners('progress', status);\n }\n const allChunks = new Uint8Array(bytes);\n let position = 0;\n for (const chunk of chunks) {\n if (typeof chunk === 'undefined')\n continue;\n allChunks.set(chunk, position);\n position += chunk.length;\n }\n blob = new Blob([allChunks.buffer], { type: contentType || undefined });\n }\n const result = await this.writeFile({\n path: options.path,\n directory: (_a = options.directory) !== null && _a !== void 0 ? _a : undefined,\n recursive: (_b = options.recursive) !== null && _b !== void 0 ? _b : false,\n data: blob,\n });\n return { path: result.uri, blob };\n };\n }\n async initDb() {\n if (this._db !== undefined) {\n return this._db;\n }\n if (!('indexedDB' in window)) {\n throw this.unavailable(\"This browser doesn't support IndexedDB\");\n }\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(this.DB_NAME, this.DB_VERSION);\n request.onupgradeneeded = FilesystemWeb.doUpgrade;\n request.onsuccess = () => {\n this._db = request.result;\n resolve(request.result);\n };\n request.onerror = () => reject(request.error);\n request.onblocked = () => {\n console.warn('db blocked');\n };\n });\n }\n static doUpgrade(event) {\n const eventTarget = event.target;\n const db = eventTarget.result;\n switch (event.oldVersion) {\n case 0:\n case 1:\n default: {\n if (db.objectStoreNames.contains('FileStorage')) {\n db.deleteObjectStore('FileStorage');\n }\n const store = db.createObjectStore('FileStorage', { keyPath: 'path' });\n store.createIndex('by_folder', 'folder');\n }\n }\n }\n async dbRequest(cmd, args) {\n const readFlag = this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn) => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const req = store[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n async dbIndexRequest(indexName, cmd, args) {\n const readFlag = this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn) => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const index = store.index(indexName);\n const req = index[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n getPath(directory, uriPath) {\n const cleanedUriPath = uriPath !== undefined ? uriPath.replace(/^[/]+|[/]+$/g, '') : '';\n let fsPath = '';\n if (directory !== undefined)\n fsPath += '/' + directory;\n if (uriPath !== '')\n fsPath += '/' + cleanedUriPath;\n return fsPath;\n }\n async clear() {\n const conn = await this.initDb();\n const tx = conn.transaction(['FileStorage'], 'readwrite');\n const store = tx.objectStore('FileStorage');\n store.clear();\n }\n /**\n * Read a file from disk\n * @param options options for the file read\n * @return a promise that resolves with the read file data result\n */\n async readFile(options) {\n const path = this.getPath(options.directory, options.path);\n // const encoding = options.encoding;\n const entry = (await this.dbRequest('get', [path]));\n if (entry === undefined)\n throw Error('File does not exist.');\n return { data: entry.content ? entry.content : '' };\n }\n /**\n * Write a file to disk in the specified location on device\n * @param options options for the file write\n * @return a promise that resolves with the file write result\n */\n async writeFile(options) {\n const path = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const doRecursive = options.recursive;\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n }\n if (!encoding && !(data instanceof Blob)) {\n data = data.indexOf(',') >= 0 ? data.split(',')[1] : data;\n if (!this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data instanceof Blob ? data.size : data.length,\n ctime: now,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n return {\n uri: pathObj.path,\n };\n }\n /**\n * Append to a file on disk in the specified location on device\n * @param options options for the file append\n * @return a promise that resolves with the file write result\n */\n async appendFile(options) {\n const path = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const now = Date.now();\n let ctime = now;\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: true,\n });\n }\n }\n if (!encoding && !this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n if (occupiedEntry !== undefined) {\n if (occupiedEntry.content instanceof Blob) {\n throw Error('The occupied entry contains a Blob object which cannot be appended to.');\n }\n if (occupiedEntry.content !== undefined && !encoding) {\n data = btoa(atob(occupiedEntry.content) + atob(data));\n }\n else {\n data = occupiedEntry.content + data;\n }\n ctime = occupiedEntry.ctime;\n }\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: ctime,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n }\n /**\n * Delete a file from disk\n * @param options options for the file delete\n * @return a promise that resolves with the deleted file data result\n */\n async deleteFile(options) {\n const path = this.getPath(options.directory, options.path);\n const entry = (await this.dbRequest('get', [path]));\n if (entry === undefined)\n throw Error('File does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [\n IDBKeyRange.only(path),\n ]);\n if (entries.length !== 0)\n throw Error('Folder is not empty.');\n await this.dbRequest('delete', [path]);\n }\n /**\n * Create a directory.\n * @param options options for the mkdir\n * @return a promise that resolves with the mkdir result\n */\n async mkdir(options) {\n const path = this.getPath(options.directory, options.path);\n const doRecursive = options.recursive;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const depth = (path.match(/\\//g) || []).length;\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (depth === 1)\n throw Error('Cannot create Root directory');\n if (occupiedEntry !== undefined)\n throw Error('Current directory does already exist.');\n if (!doRecursive && depth !== 2 && parentEntry === undefined)\n throw Error('Parent directory must exist');\n if (doRecursive && depth !== 2 && parentEntry === undefined) {\n const parentArgPath = parentPath.substr(parentPath.indexOf('/', 1));\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'directory',\n size: 0,\n ctime: now,\n mtime: now,\n };\n await this.dbRequest('put', [pathObj]);\n }\n /**\n * Remove a directory\n * @param options the options for the directory remove\n */\n async rmdir(options) {\n const { path, directory, recursive } = options;\n const fullPath = this.getPath(directory, path);\n const entry = (await this.dbRequest('get', [fullPath]));\n if (entry === undefined)\n throw Error('Folder does not exist.');\n if (entry.type !== 'directory')\n throw Error('Requested path is not a directory');\n const readDirResult = await this.readdir({ path, directory });\n if (readDirResult.files.length !== 0 && !recursive)\n throw Error('Folder is not empty');\n for (const entry of readDirResult.files) {\n const entryPath = `${path}/${entry.name}`;\n const entryObj = await this.stat({ path: entryPath, directory });\n if (entryObj.type === 'file') {\n await this.deleteFile({ path: entryPath, directory });\n }\n else {\n await this.rmdir({ path: entryPath, directory, recursive });\n }\n }\n await this.dbRequest('delete', [fullPath]);\n }\n /**\n * Return a list of files from the directory (not recursive)\n * @param options the options for the readdir operation\n * @return a promise that resolves with the readdir directory listing result\n */\n async readdir(options) {\n const path = this.getPath(options.directory, options.path);\n const entry = (await this.dbRequest('get', [path]));\n if (options.path !== '' && entry === undefined)\n throw Error('Folder does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [IDBKeyRange.only(path)]);\n const files = await Promise.all(entries.map(async (e) => {\n let subEntry = (await this.dbRequest('get', [e]));\n if (subEntry === undefined) {\n subEntry = (await this.dbRequest('get', [e + '/']));\n }\n return {\n name: e.substring(path.length + 1),\n type: subEntry.type,\n size: subEntry.size,\n ctime: subEntry.ctime,\n mtime: subEntry.mtime,\n uri: subEntry.path,\n };\n }));\n return { files: files };\n }\n /**\n * Return full File URI for a path and directory\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async getUri(options) {\n const path = this.getPath(options.directory, options.path);\n let entry = (await this.dbRequest('get', [path]));\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/']));\n }\n return {\n uri: (entry === null || entry === void 0 ? void 0 : entry.path) || path,\n };\n }\n /**\n * Return data about a file\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async stat(options) {\n const path = this.getPath(options.directory, options.path);\n let entry = (await this.dbRequest('get', [path]));\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/']));\n }\n if (entry === undefined)\n throw Error('Entry does not exist.');\n return {\n type: entry.type,\n size: entry.size,\n ctime: entry.ctime,\n mtime: entry.mtime,\n uri: entry.path,\n };\n }\n /**\n * Rename a file or directory\n * @param options the options for the rename operation\n * @return a promise that resolves with the rename result\n */\n async rename(options) {\n await this._copy(options, true);\n return;\n }\n /**\n * Copy a file or directory\n * @param options the options for the copy operation\n * @return a promise that resolves with the copy result\n */\n async copy(options) {\n return this._copy(options, false);\n }\n async requestPermissions() {\n return { publicStorage: 'granted' };\n }\n async checkPermissions() {\n return { publicStorage: 'granted' };\n }\n /**\n * Function that can perform a copy or a rename\n * @param options the options for the rename operation\n * @param doRename whether to perform a rename or copy operation\n * @return a promise that resolves with the result\n */\n async _copy(options, doRename = false) {\n let { toDirectory } = options;\n const { to, from, directory: fromDirectory } = options;\n if (!to || !from) {\n throw Error('Both to and from must be provided');\n }\n // If no \"to\" directory is provided, use the \"from\" directory\n if (!toDirectory) {\n toDirectory = fromDirectory;\n }\n const fromPath = this.getPath(fromDirectory, from);\n const toPath = this.getPath(toDirectory, to);\n // Test that the \"to\" and \"from\" locations are different\n if (fromPath === toPath) {\n return {\n uri: toPath,\n };\n }\n if (isPathParent(fromPath, toPath)) {\n throw Error('To path cannot contain the from path');\n }\n // Check the state of the \"to\" location\n let toObj;\n try {\n toObj = await this.stat({\n path: to,\n directory: toDirectory,\n });\n }\n catch (e) {\n // To location does not exist, ensure the directory containing \"to\" location exists and is a directory\n const toPathComponents = to.split('/');\n toPathComponents.pop();\n const toPath = toPathComponents.join('/');\n // Check the containing directory of the \"to\" location exists\n if (toPathComponents.length > 0) {\n const toParentDirectory = await this.stat({\n path: toPath,\n directory: toDirectory,\n });\n if (toParentDirectory.type !== 'directory') {\n throw new Error('Parent directory of the to path is a file');\n }\n }\n }\n // Cannot overwrite a directory\n if (toObj && toObj.type === 'directory') {\n throw new Error('Cannot overwrite a directory with a file');\n }\n // Ensure the \"from\" object exists\n const fromObj = await this.stat({\n path: from,\n directory: fromDirectory,\n });\n // Set the mtime/ctime of the supplied path\n const updateTime = async (path, ctime, mtime) => {\n const fullPath = this.getPath(toDirectory, path);\n const entry = (await this.dbRequest('get', [fullPath]));\n entry.ctime = ctime;\n entry.mtime = mtime;\n await this.dbRequest('put', [entry]);\n };\n const ctime = fromObj.ctime ? fromObj.ctime : Date.now();\n switch (fromObj.type) {\n // The \"from\" object is a file\n case 'file': {\n // Read the file\n const file = await this.readFile({\n path: from,\n directory: fromDirectory,\n });\n // Optionally remove the file\n if (doRename) {\n await this.deleteFile({\n path: from,\n directory: fromDirectory,\n });\n }\n let encoding;\n if (!(file.data instanceof Blob) && !this.isBase64String(file.data)) {\n encoding = Encoding.UTF8;\n }\n // Write the file to the new location\n const writeResult = await this.writeFile({\n path: to,\n directory: toDirectory,\n data: file.data,\n encoding: encoding,\n });\n // Copy the mtime/ctime of a renamed file\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n // Resolve promise\n return writeResult;\n }\n case 'directory': {\n if (toObj) {\n throw Error('Cannot move a directory over an existing object');\n }\n try {\n // Create the to directory\n await this.mkdir({\n path: to,\n directory: toDirectory,\n recursive: false,\n });\n // Copy the mtime/ctime of a renamed directory\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n }\n catch (e) {\n // ignore\n }\n // Iterate over the contents of the from location\n const contents = (await this.readdir({\n path: from,\n directory: fromDirectory,\n })).files;\n for (const filename of contents) {\n // Move item from the from directory to the to directory\n await this._copy({\n from: `${from}/${filename.name}`,\n to: `${to}/${filename.name}`,\n directory: fromDirectory,\n toDirectory,\n }, doRename);\n }\n // Optionally remove the original from directory\n if (doRename) {\n await this.rmdir({\n path: from,\n directory: fromDirectory,\n });\n }\n }\n }\n return {\n uri: toPath,\n };\n }\n isBase64String(str) {\n try {\n return btoa(atob(str)) == str;\n }\n catch (err) {\n return false;\n }\n }\n}\nFilesystemWeb._debug = true;\n//# sourceMappingURL=web.js.map"],"names":["Directory","Encoding","registerPlugin","WebPlugin","buildRequestInit"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,SAAS,EAAE;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,WAAW,CAAC,GAAG,WAAW;IACxC;IACA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IAChD,qBAAqB,CAAC;IACtB;IACA;IACA;IACA,QAAQ,OAAO;IACf,YAAY,GAAG,EAAE,MAAM;IACvB,SAAS;IACT;IACA,IAAI,cAAc,CAAC,GAAG,EAAE;IACxB,QAAQ,IAAI;IACZ,YAAY,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG;IACzC;IACA,QAAQ,OAAO,GAAG,EAAE;IACpB,YAAY,OAAO,KAAK;IACxB;IACA;IACA;IACA,aAAa,CAAC,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var Directory;\n(function (Directory) {\n /**\n * The Documents directory.\n * On iOS it's the app's documents directory.\n * Use this directory to store user-generated content.\n * On Android it's the Public Documents folder, so it's accessible from other apps.\n * It's not accessible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * On Android 11 or newer the app can only access the files/folders the app created.\n *\n * @since 1.0.0\n */\n Directory[\"Documents\"] = \"DOCUMENTS\";\n /**\n * The Data directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n Directory[\"Data\"] = \"DATA\";\n /**\n * The Library directory.\n * On iOS it will use the Library directory.\n * On Android it's the directory holding application files.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.1.0\n */\n Directory[\"Library\"] = \"LIBRARY\";\n /**\n * The Cache directory.\n * Can be deleted in cases of low memory, so use this directory to write app-specific files.\n * that your app can re-create easily.\n *\n * @since 1.0.0\n */\n Directory[\"Cache\"] = \"CACHE\";\n /**\n * The external directory.\n * On iOS it will use the Documents directory.\n * On Android it's the directory on the primary shared/external\n * storage device where the application can place persistent files it owns.\n * These files are internal to the applications, and not typically visible\n * to the user as media.\n * Files will be deleted when the application is uninstalled.\n *\n * @since 1.0.0\n */\n Directory[\"External\"] = \"EXTERNAL\";\n /**\n * The external storage directory.\n * On iOS it will use the Documents directory.\n * On Android it's the primary shared/external storage directory.\n * It's not accessible on Android 10 unless the app enables legacy External Storage\n * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n * in the `AndroidManifest.xml`.\n * It's not accessible on Android 11 or newer.\n *\n * @since 1.0.0\n */\n Directory[\"ExternalStorage\"] = \"EXTERNAL_STORAGE\";\n /**\n * The external cache directory.\n * On iOS it will use the Documents directory.\n * On Android it's the primary shared/external cache.\n *\n * @since 7.1.0\n */\n Directory[\"ExternalCache\"] = \"EXTERNAL_CACHE\";\n /**\n * The Library directory without cloud backup. Used in iOS.\n * On Android it's the directory holding application files.\n *\n * @since 7.1.0\n */\n Directory[\"LibraryNoCloud\"] = \"LIBRARY_NO_CLOUD\";\n /**\n * A temporary directory for iOS.\n * On Android it's the directory holding the application cache.\n *\n * @since 7.1.0\n */\n Directory[\"Temporary\"] = \"TEMPORARY\";\n})(Directory || (Directory = {}));\nexport var Encoding;\n(function (Encoding) {\n /**\n * Eight-bit UCS Transformation Format\n *\n * @since 1.0.0\n */\n Encoding[\"UTF8\"] = \"utf8\";\n /**\n * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the\n * Unicode character set\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n Encoding[\"ASCII\"] = \"ascii\";\n /**\n * Sixteen-bit UCS Transformation Format, byte order identified by an\n * optional byte-order mark\n * This encoding is only supported on Android.\n *\n * @since 1.0.0\n */\n Encoding[\"UTF16\"] = \"utf16\";\n})(Encoding || (Encoding = {}));\n/**\n * @deprecated Use `Directory`.\n * @since 1.0.0\n */\nexport const FilesystemDirectory = Directory;\n/**\n * @deprecated Use `Encoding`.\n * @since 1.0.0\n */\nexport const FilesystemEncoding = Encoding;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nimport { exposeSynapse } from '@capacitor/synapse';\nconst Filesystem = registerPlugin('Filesystem', {\n web: () => import('./web').then((m) => new m.FilesystemWeb()),\n});\nexposeSynapse();\nexport * from './definitions';\nexport { Filesystem };\n//# sourceMappingURL=index.js.map","import { WebPlugin, buildRequestInit } from '@capacitor/core';\nimport { Encoding } from './definitions';\nfunction resolve(path) {\n const posix = path.split('/').filter((item) => item !== '.');\n const newPosix = [];\n posix.forEach((item) => {\n if (item === '..' && newPosix.length > 0 && newPosix[newPosix.length - 1] !== '..') {\n newPosix.pop();\n }\n else {\n newPosix.push(item);\n }\n });\n return newPosix.join('/');\n}\nfunction isPathParent(parent, children) {\n parent = resolve(parent);\n children = resolve(children);\n const pathsA = parent.split('/');\n const pathsB = children.split('/');\n return parent !== children && pathsA.every((value, index) => value === pathsB[index]);\n}\nexport class FilesystemWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.DB_VERSION = 1;\n this.DB_NAME = 'Disc';\n this._writeCmds = ['add', 'put', 'delete'];\n /**\n * Function that performs a http request to a server and downloads the file to the specified destination\n *\n * @deprecated Use the @capacitor/file-transfer plugin instead.\n * @param options the options for the download operation\n * @returns a promise that resolves with the download file result\n */\n this.downloadFile = async (options) => {\n var _a, _b;\n const requestInit = buildRequestInit(options, options.webFetchExtra);\n const response = await fetch(options.url, requestInit);\n let blob;\n if (!options.progress)\n blob = await response.blob();\n else if (!(response === null || response === void 0 ? void 0 : response.body))\n blob = new Blob();\n else {\n const reader = response.body.getReader();\n let bytes = 0;\n const chunks = [];\n const contentType = response.headers.get('content-type');\n const contentLength = parseInt(response.headers.get('content-length') || '0', 10);\n while (true) {\n const { done, value } = await reader.read();\n if (done)\n break;\n chunks.push(value);\n bytes += (value === null || value === void 0 ? void 0 : value.length) || 0;\n const status = {\n url: options.url,\n bytes,\n contentLength,\n };\n this.notifyListeners('progress', status);\n }\n const allChunks = new Uint8Array(bytes);\n let position = 0;\n for (const chunk of chunks) {\n if (typeof chunk === 'undefined')\n continue;\n allChunks.set(chunk, position);\n position += chunk.length;\n }\n blob = new Blob([allChunks.buffer], { type: contentType || undefined });\n }\n const result = await this.writeFile({\n path: options.path,\n directory: (_a = options.directory) !== null && _a !== void 0 ? _a : undefined,\n recursive: (_b = options.recursive) !== null && _b !== void 0 ? _b : false,\n data: blob,\n });\n return { path: result.uri, blob };\n };\n }\n readFileInChunks(_options, _callback) {\n throw this.unavailable('Method not implemented.');\n }\n async initDb() {\n if (this._db !== undefined) {\n return this._db;\n }\n if (!('indexedDB' in window)) {\n throw this.unavailable(\"This browser doesn't support IndexedDB\");\n }\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(this.DB_NAME, this.DB_VERSION);\n request.onupgradeneeded = FilesystemWeb.doUpgrade;\n request.onsuccess = () => {\n this._db = request.result;\n resolve(request.result);\n };\n request.onerror = () => reject(request.error);\n request.onblocked = () => {\n console.warn('db blocked');\n };\n });\n }\n static doUpgrade(event) {\n const eventTarget = event.target;\n const db = eventTarget.result;\n switch (event.oldVersion) {\n case 0:\n case 1:\n default: {\n if (db.objectStoreNames.contains('FileStorage')) {\n db.deleteObjectStore('FileStorage');\n }\n const store = db.createObjectStore('FileStorage', { keyPath: 'path' });\n store.createIndex('by_folder', 'folder');\n }\n }\n }\n async dbRequest(cmd, args) {\n const readFlag = this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn) => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const req = store[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n async dbIndexRequest(indexName, cmd, args) {\n const readFlag = this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn) => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const index = store.index(indexName);\n const req = index[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n getPath(directory, uriPath) {\n const cleanedUriPath = uriPath !== undefined ? uriPath.replace(/^[/]+|[/]+$/g, '') : '';\n let fsPath = '';\n if (directory !== undefined)\n fsPath += '/' + directory;\n if (uriPath !== '')\n fsPath += '/' + cleanedUriPath;\n return fsPath;\n }\n async clear() {\n const conn = await this.initDb();\n const tx = conn.transaction(['FileStorage'], 'readwrite');\n const store = tx.objectStore('FileStorage');\n store.clear();\n }\n /**\n * Read a file from disk\n * @param options options for the file read\n * @return a promise that resolves with the read file data result\n */\n async readFile(options) {\n const path = this.getPath(options.directory, options.path);\n // const encoding = options.encoding;\n const entry = (await this.dbRequest('get', [path]));\n if (entry === undefined)\n throw Error('File does not exist.');\n return { data: entry.content ? entry.content : '' };\n }\n /**\n * Write a file to disk in the specified location on device\n * @param options options for the file write\n * @return a promise that resolves with the file write result\n */\n async writeFile(options) {\n const path = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const doRecursive = options.recursive;\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n }\n if (!encoding && !(data instanceof Blob)) {\n data = data.indexOf(',') >= 0 ? data.split(',')[1] : data;\n if (!this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data instanceof Blob ? data.size : data.length,\n ctime: now,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n return {\n uri: pathObj.path,\n };\n }\n /**\n * Append to a file on disk in the specified location on device\n * @param options options for the file append\n * @return a promise that resolves with the file write result\n */\n async appendFile(options) {\n const path = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const now = Date.now();\n let ctime = now;\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: true,\n });\n }\n }\n if (!encoding && !this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n if (occupiedEntry !== undefined) {\n if (occupiedEntry.content instanceof Blob) {\n throw Error('The occupied entry contains a Blob object which cannot be appended to.');\n }\n if (occupiedEntry.content !== undefined && !encoding) {\n data = btoa(atob(occupiedEntry.content) + atob(data));\n }\n else {\n data = occupiedEntry.content + data;\n }\n ctime = occupiedEntry.ctime;\n }\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: ctime,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n }\n /**\n * Delete a file from disk\n * @param options options for the file delete\n * @return a promise that resolves with the deleted file data result\n */\n async deleteFile(options) {\n const path = this.getPath(options.directory, options.path);\n const entry = (await this.dbRequest('get', [path]));\n if (entry === undefined)\n throw Error('File does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [IDBKeyRange.only(path)]);\n if (entries.length !== 0)\n throw Error('Folder is not empty.');\n await this.dbRequest('delete', [path]);\n }\n /**\n * Create a directory.\n * @param options options for the mkdir\n * @return a promise that resolves with the mkdir result\n */\n async mkdir(options) {\n const path = this.getPath(options.directory, options.path);\n const doRecursive = options.recursive;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const depth = (path.match(/\\//g) || []).length;\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (depth === 1)\n throw Error('Cannot create Root directory');\n if (occupiedEntry !== undefined)\n throw Error('Current directory does already exist.');\n if (!doRecursive && depth !== 2 && parentEntry === undefined)\n throw Error('Parent directory must exist');\n if (doRecursive && depth !== 2 && parentEntry === undefined) {\n const parentArgPath = parentPath.substr(parentPath.indexOf('/', 1));\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'directory',\n size: 0,\n ctime: now,\n mtime: now,\n };\n await this.dbRequest('put', [pathObj]);\n }\n /**\n * Remove a directory\n * @param options the options for the directory remove\n */\n async rmdir(options) {\n const { path, directory, recursive } = options;\n const fullPath = this.getPath(directory, path);\n const entry = (await this.dbRequest('get', [fullPath]));\n if (entry === undefined)\n throw Error('Folder does not exist.');\n if (entry.type !== 'directory')\n throw Error('Requested path is not a directory');\n const readDirResult = await this.readdir({ path, directory });\n if (readDirResult.files.length !== 0 && !recursive)\n throw Error('Folder is not empty');\n for (const entry of readDirResult.files) {\n const entryPath = `${path}/${entry.name}`;\n const entryObj = await this.stat({ path: entryPath, directory });\n if (entryObj.type === 'file') {\n await this.deleteFile({ path: entryPath, directory });\n }\n else {\n await this.rmdir({ path: entryPath, directory, recursive });\n }\n }\n await this.dbRequest('delete', [fullPath]);\n }\n /**\n * Return a list of files from the directory (not recursive)\n * @param options the options for the readdir operation\n * @return a promise that resolves with the readdir directory listing result\n */\n async readdir(options) {\n const path = this.getPath(options.directory, options.path);\n const entry = (await this.dbRequest('get', [path]));\n if (options.path !== '' && entry === undefined)\n throw Error('Folder does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [IDBKeyRange.only(path)]);\n const files = await Promise.all(entries.map(async (e) => {\n let subEntry = (await this.dbRequest('get', [e]));\n if (subEntry === undefined) {\n subEntry = (await this.dbRequest('get', [e + '/']));\n }\n return {\n name: e.substring(path.length + 1),\n type: subEntry.type,\n size: subEntry.size,\n ctime: subEntry.ctime,\n mtime: subEntry.mtime,\n uri: subEntry.path,\n };\n }));\n return { files: files };\n }\n /**\n * Return full File URI for a path and directory\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async getUri(options) {\n const path = this.getPath(options.directory, options.path);\n let entry = (await this.dbRequest('get', [path]));\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/']));\n }\n return {\n uri: (entry === null || entry === void 0 ? void 0 : entry.path) || path,\n };\n }\n /**\n * Return data about a file\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async stat(options) {\n const path = this.getPath(options.directory, options.path);\n let entry = (await this.dbRequest('get', [path]));\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/']));\n }\n if (entry === undefined)\n throw Error('Entry does not exist.');\n return {\n name: entry.path.substring(path.length + 1),\n type: entry.type,\n size: entry.size,\n ctime: entry.ctime,\n mtime: entry.mtime,\n uri: entry.path,\n };\n }\n /**\n * Rename a file or directory\n * @param options the options for the rename operation\n * @return a promise that resolves with the rename result\n */\n async rename(options) {\n await this._copy(options, true);\n return;\n }\n /**\n * Copy a file or directory\n * @param options the options for the copy operation\n * @return a promise that resolves with the copy result\n */\n async copy(options) {\n return this._copy(options, false);\n }\n async requestPermissions() {\n return { publicStorage: 'granted' };\n }\n async checkPermissions() {\n return { publicStorage: 'granted' };\n }\n /**\n * Function that can perform a copy or a rename\n * @param options the options for the rename operation\n * @param doRename whether to perform a rename or copy operation\n * @return a promise that resolves with the result\n */\n async _copy(options, doRename = false) {\n let { toDirectory } = options;\n const { to, from, directory: fromDirectory } = options;\n if (!to || !from) {\n throw Error('Both to and from must be provided');\n }\n // If no \"to\" directory is provided, use the \"from\" directory\n if (!toDirectory) {\n toDirectory = fromDirectory;\n }\n const fromPath = this.getPath(fromDirectory, from);\n const toPath = this.getPath(toDirectory, to);\n // Test that the \"to\" and \"from\" locations are different\n if (fromPath === toPath) {\n return {\n uri: toPath,\n };\n }\n if (isPathParent(fromPath, toPath)) {\n throw Error('To path cannot contain the from path');\n }\n // Check the state of the \"to\" location\n let toObj;\n try {\n toObj = await this.stat({\n path: to,\n directory: toDirectory,\n });\n }\n catch (e) {\n // To location does not exist, ensure the directory containing \"to\" location exists and is a directory\n const toPathComponents = to.split('/');\n toPathComponents.pop();\n const toPath = toPathComponents.join('/');\n // Check the containing directory of the \"to\" location exists\n if (toPathComponents.length > 0) {\n const toParentDirectory = await this.stat({\n path: toPath,\n directory: toDirectory,\n });\n if (toParentDirectory.type !== 'directory') {\n throw new Error('Parent directory of the to path is a file');\n }\n }\n }\n // Cannot overwrite a directory\n if (toObj && toObj.type === 'directory') {\n throw new Error('Cannot overwrite a directory with a file');\n }\n // Ensure the \"from\" object exists\n const fromObj = await this.stat({\n path: from,\n directory: fromDirectory,\n });\n // Set the mtime/ctime of the supplied path\n const updateTime = async (path, ctime, mtime) => {\n const fullPath = this.getPath(toDirectory, path);\n const entry = (await this.dbRequest('get', [fullPath]));\n entry.ctime = ctime;\n entry.mtime = mtime;\n await this.dbRequest('put', [entry]);\n };\n const ctime = fromObj.ctime ? fromObj.ctime : Date.now();\n switch (fromObj.type) {\n // The \"from\" object is a file\n case 'file': {\n // Read the file\n const file = await this.readFile({\n path: from,\n directory: fromDirectory,\n });\n // Optionally remove the file\n if (doRename) {\n await this.deleteFile({\n path: from,\n directory: fromDirectory,\n });\n }\n let encoding;\n if (!(file.data instanceof Blob) && !this.isBase64String(file.data)) {\n encoding = Encoding.UTF8;\n }\n // Write the file to the new location\n const writeResult = await this.writeFile({\n path: to,\n directory: toDirectory,\n data: file.data,\n encoding: encoding,\n });\n // Copy the mtime/ctime of a renamed file\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n // Resolve promise\n return writeResult;\n }\n case 'directory': {\n if (toObj) {\n throw Error('Cannot move a directory over an existing object');\n }\n try {\n // Create the to directory\n await this.mkdir({\n path: to,\n directory: toDirectory,\n recursive: false,\n });\n // Copy the mtime/ctime of a renamed directory\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n }\n catch (e) {\n // ignore\n }\n // Iterate over the contents of the from location\n const contents = (await this.readdir({\n path: from,\n directory: fromDirectory,\n })).files;\n for (const filename of contents) {\n // Move item from the from directory to the to directory\n await this._copy({\n from: `${from}/${filename.name}`,\n to: `${to}/${filename.name}`,\n directory: fromDirectory,\n toDirectory,\n }, doRename);\n }\n // Optionally remove the original from directory\n if (doRename) {\n await this.rmdir({\n path: from,\n directory: fromDirectory,\n });\n }\n }\n }\n return {\n uri: toPath,\n };\n }\n isBase64String(str) {\n try {\n return btoa(atob(str)) == str;\n }\n catch (err) {\n return false;\n }\n }\n}\nFilesystemWeb._debug = true;\n//# sourceMappingURL=web.js.map"],"names":["Directory","Encoding","registerPlugin","exposeSynapse","WebPlugin","buildRequestInit"],"mappings":";;;AAAWA,+BAAU;IACrB,CAAC,UAAU,SAAS,EAAE;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC;IACzC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC/B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IACrC;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACjC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;IACvC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,iBAAiB,CAA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oding {
6
+ if let encodingParameter = getString(key) {
7
+ .string(encoding: .create(from: encodingParameter))
8
+ } else {
9
+ .byteBuffer
10
+ }
11
+ }
12
+
13
+ func getSearchPath(_ key: String) -> IONFILESearchPath {
14
+ getSearchPath(key, withDefaultSearchPath: .raw, andDefaultDirectoryType: .document)
15
+ }
16
+
17
+ func getSearchPath(_ key: String, withDefault defaultValue: IONFILESearchPath) -> IONFILESearchPath {
18
+ getSearchPath(key, withDefaultSearchPath: defaultValue)
19
+ }
20
+
21
+ func getEncodingMapper() -> IONFILEEncodingValueMapper? {
22
+ guard let data: String = getString(Constants.MethodParameter.data) else {
23
+ return nil
24
+ }
25
+ return switch getEncoding(Constants.MethodParameter.encoding) {
26
+ case .byteBuffer:
27
+ if let base64Data = Data.capacitor.data(base64EncodedOrDataUrl: data) {
28
+ .byteBuffer(value: base64Data)
29
+ } else {
30
+ nil
31
+ }
32
+ case .string(encoding: let stringEncoding):
33
+ .string(encoding: stringEncoding, value: data)
34
+ @unknown default: nil
35
+ }
36
+ }
37
+
38
+ func getIONFileMethod() -> IONFileMethod {
39
+ return IONFileMethod(rawValue: self.methodName) ?? IONFileMethod.getUri
40
+ }
41
+
42
+ func handleSuccess(_ data: PluginCallResultData?, _ keepCallAlive: Bool = false) {
43
+ keepAlive = keepCallAlive
44
+ if let data {
45
+ resolve(data)
46
+ } else {
47
+ resolve()
48
+ }
49
+ }
50
+
51
+ func handlePermissionSuccess() {
52
+ handleSuccess([Constants.ResultDataKey.publicStorage: Constants.ResultDataValue.granted])
53
+ }
54
+
55
+ func handleError(_ error: FilesystemError) {
56
+ let errorPair = error.toCodeMessagePair()
57
+ reject(errorPair.message, errorPair.code)
58
+ }
59
+
60
+ private func getSearchPath(
61
+ _ key: String, withDefaultSearchPath defaultSearchPath: IONFILESearchPath, andDefaultDirectoryType defaultDirectoryType: IONFILEDirectoryType? = nil
62
+ ) -> IONFILESearchPath {
63
+ guard let directoryParameter = getString(key) else {
64
+ return defaultSearchPath
65
+ }
66
+
67
+ return if let type = IONFILEDirectoryType.create(from: directoryParameter) ?? defaultDirectoryType {
68
+ .directory(type: type)
69
+ } else {
70
+ defaultSearchPath
71
+ }
72
+ }
73
+ }
@@ -0,0 +1,61 @@
1
+ struct Constants {
2
+ struct ConfigurationValue {
3
+ static let endOfFile = ""
4
+ }
5
+
6
+ struct DirectoryTypeValue {
7
+ static let cache = "CACHE"
8
+ static let data = "DATA"
9
+ static let documents = "DOCUMENTS"
10
+ static let external = "EXTERNAL"
11
+ static let externalCache = "EXTERNAL_CACHE"
12
+ static let externalStorage = "EXTERNAL_STORAGE"
13
+ static let library = "LIBRARY"
14
+ static let libraryNoCloud = "LIBRARY_NO_CLOUD"
15
+ static let temporary = "TEMPORARY"
16
+ }
17
+
18
+ struct FileItemTypeValue {
19
+ static let directory = "directory"
20
+ static let file = "file"
21
+ static let fallback = ""
22
+ }
23
+
24
+ struct MethodParameter {
25
+ static let data = "data"
26
+ static let directory = "directory"
27
+ static let encoding = "encoding"
28
+ static let chunkSize = "chunkSize"
29
+ static let from = "from"
30
+ static let path = "path"
31
+ static let recursive = "recursive"
32
+ static let to = "to"
33
+ static let toDirectory = "toDirectory"
34
+ }
35
+
36
+ struct ResultDataKey {
37
+ static let data = "data"
38
+ static let files = "files"
39
+ static let uri = "uri"
40
+ static let publicStorage = "publicStorage"
41
+ }
42
+
43
+ struct ResultDataValue {
44
+ static let granted = "granted"
45
+ }
46
+
47
+ struct ItemAttributeJSONKey {
48
+ static let ctime = "ctime"
49
+ static let mtime = "mtime"
50
+ static let name = "name"
51
+ static let size = "size"
52
+ static let type = "type"
53
+ static let uri = "uri"
54
+ }
55
+
56
+ struct StringEncodingValue {
57
+ static let ascii = "ascii"
58
+ static let utf16 = "utf16"
59
+ static let utf8 = "utf8"
60
+ }
61
+ }
@@ -0,0 +1,57 @@
1
+ enum IONFileMethod: String {
2
+ case readFile
3
+ case readFileInChunks
4
+ case writeFile
5
+ case appendFile
6
+ case deleteFile
7
+ case mkdir
8
+ case rmdir
9
+ case readdir
10
+ case stat
11
+ case getUri
12
+ case rename
13
+ case copy
14
+ }
15
+
16
+ enum FilesystemError: Error {
17
+ case bridgeNotInitialised
18
+ case invalidInput(method: IONFileMethod)
19
+ case invalidPath(_ path: String)
20
+ case fileNotFound(method: IONFileMethod, _ path: String)
21
+ case directoryAlreadyExists(_ path: String)
22
+ case parentDirectoryMissing
23
+ case cannotDeleteChildren
24
+ case operationFailed(method: IONFileMethod, _ error: Error)
25
+
26
+ func toCodeMessagePair() -> (code: String, message: String) {
27
+ ("OS-PLUG-FILE-\(String(format: "%04d", code))", description)
28
+ }
29
+ }
30
+
31
+ private extension FilesystemError {
32
+ var code: Int {
33
+ switch self {
34
+ case .bridgeNotInitialised: 4
35
+ case .invalidInput: 5
36
+ case .invalidPath: 6
37
+ case .fileNotFound: 8
38
+ case .directoryAlreadyExists: 10
39
+ case .parentDirectoryMissing: 11
40
+ case .cannotDeleteChildren: 12
41
+ case .operationFailed: 13
42
+ }
43
+ }
44
+
45
+ var description: String {
46
+ switch self {
47
+ case .bridgeNotInitialised: "Capacitor bridge isn't initialized."
48
+ case .invalidInput(let method): "The '\(method.rawValue)' input parameters aren't valid."
49
+ case .invalidPath(let path): "Invalid \(!path.isEmpty ? "'" + path + "' " : "")path."
50
+ case .fileNotFound(let method, let path): "'\(method.rawValue)' failed because file\(!path.isEmpty ? " at '" + path + "' " : "") does not exist."
51
+ case .directoryAlreadyExists(let path): "Directory\(!path.isEmpty ? " at '" + path + "' " : "") already exists, cannot be overwritten."
52
+ case .parentDirectoryMissing: "Missing parent directory - possibly recursive=false was passed or parent directory creation failed."
53
+ case .cannotDeleteChildren: "Cannot delete directory with children; received recursive=false but directory has contents."
54
+ case .operationFailed(let method, let error): "'\(method.rawValue)' failed with: \(error.localizedDescription)"
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,39 @@
1
+ import Capacitor
2
+ import Foundation
3
+ import IONFilesystemLib
4
+
5
+ struct FilesystemLocationResolver {
6
+ let service: FileService
7
+
8
+ func resolveSinglePath(from call: CAPPluginCall) -> Result<URL, FilesystemError> {
9
+ guard let path = call.getString(Constants.MethodParameter.path) else {
10
+ return .failure(.invalidInput(method: call.getIONFileMethod()))
11
+ }
12
+
13
+ let directory = call.getSearchPath(Constants.MethodParameter.directory)
14
+ return resolveURL(path: path, directory: directory)
15
+ }
16
+
17
+ func resolveDualPaths(from call: CAPPluginCall) -> Result<(source: URL, destination: URL), FilesystemError> {
18
+ guard let fromPath = call.getString(Constants.MethodParameter.from), let toPath = call.getString(Constants.MethodParameter.to) else {
19
+ return .failure(.invalidInput(method: call.getIONFileMethod()))
20
+ }
21
+
22
+ let fromDirectory = call.getSearchPath(Constants.MethodParameter.directory)
23
+ let toDirectory = call.getSearchPath(Constants.MethodParameter.toDirectory, withDefault: fromDirectory)
24
+
25
+ return resolveURL(path: fromPath, directory: fromDirectory)
26
+ .flatMap { sourceURL in
27
+ resolveURL(path: toPath, directory: toDirectory)
28
+ .map { (source: sourceURL, destination: $0) }
29
+ }
30
+ }
31
+
32
+ private func resolveURL(path: String, directory: IONFILESearchPath) -> Result<URL, FilesystemError> {
33
+ return if let url = try? service.getFileURL(atPath: path, withSearchPath: directory) {
34
+ .success(url)
35
+ } else {
36
+ .failure(.invalidPath(path))
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,24 @@
1
+ import Foundation
2
+ import IONFilesystemLib
3
+
4
+ enum FilesystemOperation {
5
+ // Read Operations
6
+ case readFile(url: URL, encoding: IONFILEEncoding)
7
+ case readFileInChunks(url: URL, encoding: IONFILEEncoding, chunkSize: Int)
8
+ case readdir(url: URL)
9
+ case stat(url: URL)
10
+ case getUri(url: URL)
11
+
12
+ // Write Operations
13
+ case write(url: URL, encodingMapper: IONFILEEncodingValueMapper, recursive: Bool)
14
+ case append(url: URL, encodingMapper: IONFILEEncodingValueMapper, recursive: Bool)
15
+
16
+ // Directory Operations
17
+ case mkdir(url: URL, recursive: Bool)
18
+ case rmdir(url: URL, recursive: Bool)
19
+
20
+ // File Management Operations
21
+ case delete(url: URL)
22
+ case rename(source: URL, destination: URL)
23
+ case copy(source: URL, destination: URL)
24
+ }