1- import { TurboModuleRegistry , type TurboModule } from 'react-native' ;
1+ import {
2+ TurboModuleRegistry ,
3+ type TurboModule ,
4+ type CodegenTypes ,
5+ } from 'react-native' ;
26
37type BlobData = {
48 blobId : string ;
@@ -9,33 +13,27 @@ type BlobData = {
913 lastModified ?: number ;
1014} ;
1115
12- type GenericType =
13- | string
14- | number
15- | boolean
16- | null
17- | undefined
18- | { [ key : string ] : GenericType }
19- | GenericType [ ] ;
20-
21- type GenericMap = { [ key : string ] : GenericType } ;
22- type GenericArray = GenericType [ ] ;
16+ type FsConstants = {
17+ DocumentDirectoryPath : string ;
18+ SUPPORTS_DIRECTORY_MOVE : boolean ;
19+ SUPPORTS_ENCRYPTION : boolean ;
20+ } ;
2321
2422export interface Spec extends TurboModule {
25- constants ( ) : GenericMap ;
26- save ( blob : GenericMap , filePath : string ) : Promise < void > ;
23+ constants ( ) : FsConstants ;
24+ save ( blob : BlobData , filePath : string ) : Promise < void > ;
2725 read ( filePath : string ) : Promise < BlobData > ;
2826 move ( filePath : string , newPath : string ) : Promise < void > ;
2927 remove ( filePath : string ) : Promise < void > ;
3028 list ( dirPath : string ) : Promise < string [ ] > ;
3129 readAsDataURL ( filePath : string ) : Promise < string > ;
3230 readAsText ( filePath : string ) : Promise < string > ;
3331 fileExists ( filePath : string ) : Promise < boolean > ;
34- writeJson ( data : GenericMap , filepath : string ) : Promise < void > ;
35- readJson ( filepath : string ) : Promise < GenericMap | GenericArray > ;
32+ writeJson ( data : CodegenTypes . UnsafeObject , filepath : string ) : Promise < void > ;
33+ readJson ( filepath : string ) : Promise < CodegenTypes . UnsafeObject | null > ;
3634 setEncryptionEnabled ( enabled : boolean ) : void ;
3735}
3836
3937export default TurboModuleRegistry . getEnforcing < Spec > ( 'MxFileSystem' ) ;
4038
41- export type { BlobData , GenericMap , GenericArray } ;
39+ export type { BlobData , FsConstants } ;
0 commit comments