diff --git a/packages/capacitor-plugin/CapacitorFilesystem.podspec b/packages/capacitor-plugin/CapacitorFilesystem.podspec
index 80b4ad2..9b1d7b6 100644
--- a/packages/capacitor-plugin/CapacitorFilesystem.podspec
+++ b/packages/capacitor-plugin/CapacitorFilesystem.podspec
@@ -16,6 +16,6 @@ Pod::Spec.new do |s|
]
s.ios.deployment_target = '15.0'
s.dependency 'Capacitor'
- s.dependency 'IONFilesystemLib', spec='~> 1.0.1'
+ s.dependency 'IONFilesystemLib', spec='~> 1.1.0'
s.swift_version = '5.1'
end
diff --git a/packages/capacitor-plugin/Package.swift b/packages/capacitor-plugin/Package.swift
index ab092d6..99d362e 100644
--- a/packages/capacitor-plugin/Package.swift
+++ b/packages/capacitor-plugin/Package.swift
@@ -11,7 +11,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
- .package(url: "https://github.com/ionic-team/ion-ios-filesystem.git", from: "1.0.1")
+ .package(url: "https://github.com/ionic-team/ion-ios-filesystem.git", from: "1.1.0")
],
targets: [
.target(
diff --git a/packages/capacitor-plugin/README.md b/packages/capacitor-plugin/README.md
index 8c620cb..9a0c910 100644
--- a/packages/capacitor-plugin/README.md
+++ b/packages/capacitor-plugin/README.md
@@ -541,11 +541,13 @@ We recommend using the @capacitor/file-transfer plugin instead, in conjunction w
#### ReadFileOptions
-| Prop | Type | Description | Since |
-| --------------- | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
-| **`path`** | string | The path of the file to read | 1.0.0 |
-| **`directory`** | Directory | The `Directory` to read the file from | 1.0.0 |
-| **`encoding`** | Encoding | The encoding to read the file in, if not provided, data is read as binary and returned as base64 encoded. Pass Encoding.UTF8 to read data as string | 1.0.0 |
+| Prop | Type | Description | Default | Since |
+| --------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------- | ----- |
+| **`path`** | string | The path of the file to read | | 1.0.0 |
+| **`directory`** | Directory | The `Directory` to read the file from | | 1.0.0 |
+| **`encoding`** | Encoding | The encoding to read the file in, if not provided, data is read as binary and returned as base64 encoded. Pass Encoding.UTF8 to read data as string | | 1.0.0 |
+| **`offset`** | number | The offset to start reading the file from, in bytes. Native only (not available in web). Can be used in conjunction with length to partially read files. | 0 | 8.1.0 |
+| **`length`** | number | The length of data to read, in bytes. Any non-positive value means to read to the end of the file. Native only (not available in web). Can be used in conjunction with offset to partially read files. | -1 | 8.1.0 |
#### ReadFileInChunksOptions
diff --git a/packages/capacitor-plugin/android/build.gradle b/packages/capacitor-plugin/android/build.gradle
index b3b3ffa..ce3f263 100644
--- a/packages/capacitor-plugin/android/build.gradle
+++ b/packages/capacitor-plugin/android/build.gradle
@@ -58,7 +58,7 @@ repositories {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation "io.ionic.libs:ionfilesystem-android:1.0.0"
+ implementation "io.ionic.libs:ionfilesystem-android:1.1.0"
implementation project(':capacitor-android')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
diff --git a/packages/capacitor-plugin/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemErrors.kt b/packages/capacitor-plugin/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemErrors.kt
index 056edae..6eff078 100644
--- a/packages/capacitor-plugin/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemErrors.kt
+++ b/packages/capacitor-plugin/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemErrors.kt
@@ -97,5 +97,7 @@ fun Throwable.toFilesystemError(methodName: String): FilesystemErrors.ErrorInfo
is IONFILEExceptions.CopyRenameFailed.NoParentDirectory ->
FilesystemErrors.missingParentDirectories
+ is IllegalArgumentException -> FilesystemErrors.invalidInputMethod(methodName)
+
else -> FilesystemErrors.operationFailed(methodName, this.localizedMessage ?: "")
}
\ No newline at end of file
diff --git a/packages/capacitor-plugin/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemMethodOptions.kt b/packages/capacitor-plugin/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemMethodOptions.kt
index 6222c03..6abeb46 100644
--- a/packages/capacitor-plugin/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemMethodOptions.kt
+++ b/packages/capacitor-plugin/android/src/main/kotlin/com/capacitorjs/plugins/filesystem/FilesystemMethodOptions.kt
@@ -1,6 +1,7 @@
package com.capacitorjs.plugins.filesystem
import com.getcapacitor.PluginCall
+import io.ionic.libs.ionfilesystemlib.model.IONFILEConstants
import io.ionic.libs.ionfilesystemlib.model.IONFILEEncoding
import io.ionic.libs.ionfilesystemlib.model.IONFILEFolderType
import io.ionic.libs.ionfilesystemlib.model.IONFILEReadInChunksOptions
@@ -13,6 +14,8 @@ internal const val INPUT_APPEND = "append"
private const val INPUT_PATH = "path"
private const val INPUT_DIRECTORY = "directory"
private const val INPUT_ENCODING = "encoding"
+private const val INPUT_OFFSET = "offset"
+private const val INPUT_LENGTH = "length"
private const val INPUT_CHUNK_SIZE = "chunkSize"
private const val INPUT_DATA = "data"
private const val INPUT_RECURSIVE = "recursive"
@@ -52,7 +55,15 @@ internal data class DoubleUri(
internal fun PluginCall.getReadFileOptions(): ReadFileOptions? {
val uri = getSingleIONFILEUri() ?: return null
val encoding = IONFILEEncoding.fromEncodingName(getString(INPUT_ENCODING))
- return ReadFileOptions(uri = uri, options = IONFILEReadOptions(encoding))
+ val offsetAndLength = getOffsetAndLength()
+ return ReadFileOptions(
+ uri = uri,
+ options = IONFILEReadOptions(
+ encoding,
+ offset = offsetAndLength.first,
+ length = offsetAndLength.second
+ )
+ )
}
/**
@@ -62,9 +73,15 @@ internal fun PluginCall.getReadFileInChunksOptions(): ReadFileInChunksOptions? {
val uri = getSingleIONFILEUri() ?: return null
val encoding = IONFILEEncoding.fromEncodingName(getString(INPUT_ENCODING))
val chunkSize = getInt(INPUT_CHUNK_SIZE)?.takeIf { it > 0 } ?: return null
+ val offsetAndLength = getOffsetAndLength()
return ReadFileInChunksOptions(
uri = uri,
- options = IONFILEReadInChunksOptions(encoding, chunkSize)
+ options = IONFILEReadInChunksOptions(
+ encoding,
+ chunkSize = chunkSize,
+ offset = offsetAndLength.first,
+ length = offsetAndLength.second
+ )
)
}
@@ -123,6 +140,11 @@ internal fun PluginCall.getSingleIONFILEUri(): IONFILEUri.Unresolved? {
return unresolvedUri(path, directoryAlias)
}
+private fun PluginCall.getOffsetAndLength(): Pair = Pair(
+ getInt(INPUT_OFFSET)?.takeIf { it >= 0 } ?: 0,
+ getInt(INPUT_LENGTH)?.takeIf { it > 0 } ?: IONFILEConstants.LENGTH_READ_TIL_EOF
+)
+
private fun unresolvedUri(path: String, directoryAlias: String?) = IONFILEUri.Unresolved(
parentFolder = IONFILEFolderType.fromStringAlias(directoryAlias),
uriPath = path
diff --git a/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemConstants.swift b/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemConstants.swift
index 909e290..9b3e3d2 100644
--- a/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemConstants.swift
+++ b/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemConstants.swift
@@ -26,6 +26,8 @@ struct Constants {
static let directory = "directory"
static let encoding = "encoding"
static let chunkSize = "chunkSize"
+ static let offset = "offset"
+ static let length = "length"
static let from = "from"
static let path = "path"
static let recursive = "recursive"
diff --git a/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemOperation.swift b/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemOperation.swift
index 238420f..cba3570 100644
--- a/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemOperation.swift
+++ b/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemOperation.swift
@@ -3,8 +3,8 @@ import IONFilesystemLib
enum FilesystemOperation {
// Read Operations
- case readFile(url: URL, encoding: IONFILEEncoding)
- case readFileInChunks(url: URL, encoding: IONFILEEncoding, chunkSize: Int)
+ case readFile(url: URL, encoding: IONFILEEncoding, offset: Int, length: Int)
+ case readFileInChunks(url: URL, encoding: IONFILEEncoding, chunkSize: Int, offset: Int, length: Int)
case readdir(url: URL)
case stat(url: URL)
case getUri(url: URL)
diff --git a/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemOperationExecutor.swift b/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemOperationExecutor.swift
index afcf637..c5eea30 100644
--- a/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemOperationExecutor.swift
+++ b/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemOperationExecutor.swift
@@ -16,11 +16,11 @@ class FilesystemOperationExecutor {
var resultData: PluginCallResultData?
switch operation {
- case .readFile(let url, let encoding):
- let data = try service.readEntireFile(atURL: url, withEncoding: encoding).textValue
+ case .readFile(let url, let encoding, let offset, let length):
+ let data = try service.readEntireFile(atURL: url, withEncoding: encoding, andOffset: offset, andLength: length).textValue
resultData = [Constants.ResultDataKey.data: data]
- case .readFileInChunks(let url, let encoding, let chunkSize):
- try processFileInChunks(at: url, withEncoding: encoding, chunkSize: chunkSize, for: operation, call)
+ case .readFileInChunks(let url, let encoding, let chunkSize, let offset, let length):
+ try processFileInChunks(at: url, withEncoding: encoding, chunkSize: chunkSize, offset: offset, length: length, for: operation, call)
return
case .write(let url, let encodingMapper, let recursive):
try service.saveFile(atURL: url, withEncodingAndData: encodingMapper, includeIntermediateDirectories: recursive)
@@ -56,9 +56,9 @@ class FilesystemOperationExecutor {
}
private extension FilesystemOperationExecutor {
- func processFileInChunks(at url: URL, withEncoding encoding: IONFILEEncoding, chunkSize: Int, for operation: FilesystemOperation, _ call: CAPPluginCall) throws {
+ func processFileInChunks(at url: URL, withEncoding encoding: IONFILEEncoding, chunkSize: Int, offset: Int, length: Int, for operation: FilesystemOperation, _ call: CAPPluginCall) throws {
let chunkSizeToUse = chunkSizeToUse(basedOn: chunkSize, and: encoding)
- try service.readFileInChunks(atURL: url, withEncoding: encoding, andChunkSize: chunkSizeToUse)
+ try service.readFileInChunks(atURL: url, withEncoding: encoding, andChunkSize: chunkSizeToUse, andOffset: offset, andLength: length)
.sink(receiveCompletion: { completion in
switch completion {
case .finished:
@@ -82,8 +82,8 @@ private extension FilesystemOperationExecutor {
var path = ""
var method: IONFileMethod = IONFileMethod.getUri
switch operation {
- case .readFile(let url, _): path = url.absoluteString; method = .readFile
- case .readFileInChunks(let url, _, _): path = url.absoluteString; method = .readFileInChunks
+ case .readFile(let url, _, _, _): path = url.absoluteString; method = .readFile
+ case .readFileInChunks(let url, _, _, _, _): path = url.absoluteString; method = .readFileInChunks
case .write(let url, _, _): path = url.absoluteString; method = .writeFile
case .append(let url, _, _): path = url.absoluteString; method = .appendFile
case .delete(let url): path = url.absoluteString; method = .deleteFile
diff --git a/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemPlugin.swift b/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemPlugin.swift
index 763601a..c743510 100644
--- a/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemPlugin.swift
+++ b/packages/capacitor-plugin/ios/Sources/FilesystemPlugin/FilesystemPlugin.swift
@@ -59,8 +59,10 @@ private extension FilesystemPlugin {
*/
@objc func readFile(_ call: CAPPluginCall) {
let encoding = call.getEncoding(Constants.MethodParameter.encoding)
+ let offset = call.getInt(Constants.MethodParameter.offset) ?? 0
+ let length = call.getInt(Constants.MethodParameter.length) ?? -1
performSinglePathOperation(call) {
- .readFile(url: $0, encoding: encoding)
+ .readFile(url: $0, encoding: encoding, offset: offset, length: length)
}
}
@@ -69,8 +71,10 @@ private extension FilesystemPlugin {
guard let chunkSize = call.getInt(Constants.MethodParameter.chunkSize) else {
return call.handleError(.invalidInput(method: call.getIONFileMethod()))
}
+ let offset = call.getInt(Constants.MethodParameter.offset) ?? 0
+ let length = call.getInt(Constants.MethodParameter.length) ?? -1
performSinglePathOperation(call) {
- .readFileInChunks(url: $0, encoding: encoding, chunkSize: chunkSize)
+ .readFileInChunks(url: $0, encoding: encoding, chunkSize: chunkSize, offset: offset, length: length)
}
}
diff --git a/packages/capacitor-plugin/src/definitions.ts b/packages/capacitor-plugin/src/definitions.ts
index d7834c3..72e4141 100644
--- a/packages/capacitor-plugin/src/definitions.ts
+++ b/packages/capacitor-plugin/src/definitions.ts
@@ -229,6 +229,27 @@ export interface ReadFileOptions {
* @since 1.0.0
*/
encoding?: Encoding;
+
+ /**
+ * The offset to start reading the file from, in bytes.
+ * Native only (not available in web).
+ * Can be used in conjunction with length to partially read files.
+ *
+ * @since 8.1.0
+ * @default 0
+ */
+ offset?: number;
+
+ /**
+ * The length of data to read, in bytes.
+ * Any non-positive value means to read to the end of the file.
+ * Native only (not available in web).
+ * Can be used in conjunction with offset to partially read files.
+ *
+ * @since 8.1.0
+ * @default -1
+ */
+ length?: number;
}
export interface ReadFileInChunksOptions extends ReadFileOptions {
diff --git a/packages/example-app-capacitor/android/capacitor.settings.gradle b/packages/example-app-capacitor/android/capacitor.settings.gradle
index 33359be..e0cb898 100644
--- a/packages/example-app-capacitor/android/capacitor.settings.gradle
+++ b/packages/example-app-capacitor/android/capacitor.settings.gradle
@@ -1,12 +1,12 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
include ':capacitor-android'
-project(':capacitor-android').projectDir = new File('../../../node_modules/.pnpm/@capacitor+android@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/android/capacitor')
+project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
include ':capacitor-camera'
-project(':capacitor-camera').projectDir = new File('../../../node_modules/.pnpm/@capacitor+camera@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/camera/android')
+project(':capacitor-camera').projectDir = new File('../node_modules/@capacitor/camera/android')
include ':capacitor-splash-screen'
-project(':capacitor-splash-screen').projectDir = new File('../../../node_modules/.pnpm/@capacitor+splash-screen@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/splash-screen/android')
+project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capacitor/splash-screen/android')
include ':capacitor-filesystem'
project(':capacitor-filesystem').projectDir = new File('../../capacitor-plugin/android')
diff --git a/packages/example-app-capacitor/ios/App/Podfile b/packages/example-app-capacitor/ios/App/Podfile
index 3240b73..fb2a939 100644
--- a/packages/example-app-capacitor/ios/App/Podfile
+++ b/packages/example-app-capacitor/ios/App/Podfile
@@ -1,4 +1,4 @@
-require_relative '../../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios/scripts/pods_helpers'
+require_relative '../../node_modules/@capacitor/ios/scripts/pods_helpers'
platform :ios, '15.0'
use_frameworks!
@@ -9,10 +9,10 @@ use_frameworks!
install! 'cocoapods', :disable_input_output_paths => true
def capacitor_pods
- pod 'Capacitor', :path => '../../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios'
- pod 'CapacitorCordova', :path => '../../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios'
- pod 'CapacitorCamera', :path => '../../../../node_modules/.pnpm/@capacitor+camera@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/camera'
- pod 'CapacitorSplashScreen', :path => '../../../../node_modules/.pnpm/@capacitor+splash-screen@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/splash-screen'
+ pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
+ pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
+ pod 'CapacitorCamera', :path => '../../node_modules/@capacitor/camera'
+ pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'
pod 'CapacitorFilesystem', :path => '../../../capacitor-plugin'
end
diff --git a/packages/example-app-capacitor/ios/App/Podfile.lock b/packages/example-app-capacitor/ios/App/Podfile.lock
index 6847e63..8973ac1 100644
--- a/packages/example-app-capacitor/ios/App/Podfile.lock
+++ b/packages/example-app-capacitor/ios/App/Podfile.lock
@@ -1,22 +1,22 @@
PODS:
- - Capacitor (8.0.0-beta.0):
+ - Capacitor (8.0.1):
- CapacitorCordova
- - CapacitorCamera (8.0.0-beta.0):
+ - CapacitorCamera (8.0.0):
- Capacitor
- - CapacitorCordova (8.0.0-beta.0)
- - CapacitorFilesystem (8.0.0-next.3):
+ - CapacitorCordova (8.0.1)
+ - CapacitorFilesystem (8.0.0):
- Capacitor
- - IONFilesystemLib (~> 1.0.1)
- - CapacitorSplashScreen (8.0.0-beta.0):
+ - IONFilesystemLib (~> 1.1.0)
+ - CapacitorSplashScreen (8.0.0):
- Capacitor
- - IONFilesystemLib (1.0.1)
+ - IONFilesystemLib (1.1.0)
DEPENDENCIES:
- - "Capacitor (from `../../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios`)"
- - "CapacitorCamera (from `../../../../node_modules/.pnpm/@capacitor+camera@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/camera`)"
- - "CapacitorCordova (from `../../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios`)"
+ - "Capacitor (from `../../node_modules/@capacitor/ios`)"
+ - "CapacitorCamera (from `../../node_modules/@capacitor/camera`)"
+ - "CapacitorCordova (from `../../node_modules/@capacitor/ios`)"
- CapacitorFilesystem (from `../../../capacitor-plugin`)
- - "CapacitorSplashScreen (from `../../../../node_modules/.pnpm/@capacitor+splash-screen@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/splash-screen`)"
+ - "CapacitorSplashScreen (from `../../node_modules/@capacitor/splash-screen`)"
SPEC REPOS:
trunk:
@@ -24,24 +24,24 @@ SPEC REPOS:
EXTERNAL SOURCES:
Capacitor:
- :path: "../../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios"
+ :path: "../../node_modules/@capacitor/ios"
CapacitorCamera:
- :path: "../../../../node_modules/.pnpm/@capacitor+camera@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/camera"
+ :path: "../../node_modules/@capacitor/camera"
CapacitorCordova:
- :path: "../../../../node_modules/.pnpm/@capacitor+ios@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/ios"
+ :path: "../../node_modules/@capacitor/ios"
CapacitorFilesystem:
:path: "../../../capacitor-plugin"
CapacitorSplashScreen:
- :path: "../../../../node_modules/.pnpm/@capacitor+splash-screen@8.0.0-beta.0_@capacitor+core@8.0.0-beta.0/node_modules/@capacitor/splash-screen"
+ :path: "../../node_modules/@capacitor/splash-screen"
SPEC CHECKSUMS:
- Capacitor: cdbe01d8f7b542b2750fb51e88051e764b3cbc4e
- CapacitorCamera: 7ff9e46889cbd3bba2ed0a4192d40f91bd1b5f05
- CapacitorCordova: 65a0b71358d76bdeb799f45cd0214d68fbe2fd56
- CapacitorFilesystem: 744a5be26e8f658c60a149401dff136ede834bb8
- CapacitorSplashScreen: ab1ec150884e35c67c7709c907b3db3a376b9956
- IONFilesystemLib: 89258b8e3e85465da93127d25d7ce37f977e8a6f
+ Capacitor: ff35b0f66370b84aa238251b35b91886a3207c16
+ CapacitorCamera: 592acb7ab9fb748e2d8571eb03af30ec4e1ace12
+ CapacitorCordova: 0d65b9bb74e995dcecb9463f34f1af2aba6f955c
+ CapacitorFilesystem: c650a2b46e2bbeb4709aef2bcf0a44597e20158c
+ CapacitorSplashScreen: 422880d7117605c30699eb4b21644b62db42e86c
+ IONFilesystemLib: 50b9a0f3052a9b40b9bedb43f328a8fe222f9f87
-PODFILE CHECKSUM: bcc6c8bf6cebbd15c772e65f0a0c65a41e700610
+PODFILE CHECKSUM: f9801285586b6499bc9e372b1475a3f09f847217
COCOAPODS: 1.16.2
diff --git a/packages/example-app-capacitor/package.json b/packages/example-app-capacitor/package.json
index 7a11331..a4a5914 100644
--- a/packages/example-app-capacitor/package.json
+++ b/packages/example-app-capacitor/package.json
@@ -14,10 +14,10 @@
},
"dependencies": {
"@capacitor/android": "^8.0.0",
- "@capacitor/camera": "^7.0.0 || ^8.0.0",
+ "@capacitor/camera": "^8.0.0",
"@capacitor/core": "^8.0.0",
"@capacitor/ios": "^8.0.0",
- "@capacitor/splash-screen": "^7.0.0 || ^8.0.0",
+ "@capacitor/splash-screen": "^8.0.0",
"@capacitor/filesystem": "file:../capacitor-plugin"
},
"devDependencies": {
diff --git a/packages/example-app-capacitor/src/js/capacitor-welcome.js b/packages/example-app-capacitor/src/js/capacitor-welcome.js
index a995afb..f2fee99 100644
--- a/packages/example-app-capacitor/src/js/capacitor-welcome.js
+++ b/packages/example-app-capacitor/src/js/capacitor-welcome.js
@@ -75,6 +75,8 @@ window.customElements.define(
+
+
@@ -202,7 +204,35 @@ window.customElements.define(
}
console.log('chunk read', JSON.stringify(chunkResult))
}
- );
+ );
+ });
+ self.shadowRoot.querySelector('#fileReadPartial').addEventListener('click', async function (e) {
+ let contents = await Filesystem.readFile({
+ path: 'secrets/text.txt',
+ directory: Directory.Documents,
+ encoding: Encoding.UTF8,
+ offset: 4,
+ length: 5
+ });
+ console.log('file contents', contents.data);
+ });
+ self.shadowRoot.querySelector('#fileReadInSmallChunksPartial').addEventListener('click', async function (e) {
+ await Filesystem.readFileInChunks(
+ {
+ path: 'secrets/text.txt',
+ directory: Directory.Documents,
+ encoding: Encoding.UTF8,
+ chunkSize: 3, // on Android the chunk size to be used will be much larger
+ offset: 14
+ },
+ (chunkResult, err) => {
+ if (err) {
+ console.log(err)
+ return
+ }
+ console.log('chunk read', JSON.stringify(chunkResult))
+ }
+ );
});
self.shadowRoot.querySelector('#fileAppend').addEventListener('click', async function (e) {
await Filesystem.appendFile({