Skip to content

Commit 90dbf39

Browse files
chore: add missing readAsText spec
1 parent 6bec83b commit 90dbf39

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

mendix-native-0.0.1.tgz

3.22 KB
Binary file not shown.

src/file-system.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Mx from './specs/NativeMendixNative';
1+
import Mx, { type BlobData } from './specs/NativeMendixNative';
22

33
const initFs = () => {
44
const {
@@ -14,16 +14,17 @@ const initFs = () => {
1414
SUPPORTS_ENCRYPTION: cast<boolean>(SUPPORTS_ENCRYPTION),
1515

1616
//Methods - signature matches with specs
17-
save: Mx.fsSave,
1817
read: Mx.fsRead,
1918
list: Mx.fsList,
2019
readAsDataURL: Mx.fsReadAsDataURL,
20+
readAsText: Mx.fsReadAsText, //Android only
2121
fileExists: Mx.fsFileExists,
2222
move: Mx.fsMove,
2323
remove: Mx.fsRemove,
2424
setEncryptionEnabled: Mx.fsSetEncryptionEnabled,
2525

2626
//Methods - signature modified since specs does not recognize Record<string, any> and generics
27+
save: (blob: BlobData, filePath: string) => Mx.fsSave(blob, filePath),
2728
writeJson: (data: Record<string, any>, filepath: string) =>
2829
Mx.fsWriteJson(data, filepath),
2930
readJson: <T>(filepath: string) => Mx.fsReadJson(filepath) as Promise<T>,

src/specs/NativeMendixNative.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export interface Spec extends TurboModule {
4040
fsRemove(filePath: string): Promise<void>;
4141
fsList(dirPath: string): Promise<string[]>;
4242
fsReadAsDataURL(filePath: string): Promise<string>;
43+
fsReadAsText(filePath: string): Promise<string>; //Android only
4344
fsFileExists(filePath: string): Promise<boolean>;
4445
fsWriteJson(data: GenericMap, filepath: string): Promise<void>;
4546
fsReadJson(filepath: string): Promise<GenericMap | GenericArray>;

0 commit comments

Comments
 (0)