# hnq90/react-native-filesystem-v1 architecture

> Architecture diagram of the GitHub repository hnq90/react-native-filesystem-v1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hnq90/react-native-filesystem-v1
- Repository: https://github.com/hnq90/react-native-filesystem-v1

## Overview

##### Component Details

React Native Application Layer:
- JavaScript Module (FileSystem.js)
- Main API methods:
- writeToFile()
- readFile()
- delete()
- fileExists()
- directoryExists()

Bridge Layer:
- React Native Bridge
- Promise-based communication flow

Native Implementations Layer (split into three parallel sections):
- iOS Implementation (RNFileSystem.m)
- Android Implementation (RNFileSystem.java)
- Windows Implementation (RNFileSystemModule.cs)

##### Storage Classes Representation
- Backed Up Storage
- Important Storage
- Auxiliary Storage
- Temporary Storage

##### Specific details

Annotations for:
- UTF-8 encoding specification
- Promise-based interactions
- Automatic sub-directory creation
- Platform-specific storage locations

##### Technical Notes

A notes section highlighting:
- Cross-platform compatibility
- Native module linking requirements
- Storage class guidelines compliance
- Error handling flow

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef js fill:#3498db,color:white
    classDef native fill:#2ecc71,color:white
    classDef bridge fill:#f1c40f,color:black
    classDef storage fill:#95a5a6,color:white
    classDef test fill:#e74c3c,color:white
    classDef config fill:#9b59b6,color:white
    classDef docs fill:#34495e,color:white

    subgraph "React Native Application Layer"
        JSAPI["JavaScript API Module"]:::js
        API1["writeToFile()"]:::js
        API2["readFile()"]:::js
        API3["delete()"]:::js
        API4["fileExists()"]:::js
        API5["directoryExists()"]:::js
        
        JSAPI --> API1
        JSAPI --> API2
        JSAPI --> API3
        JSAPI --> API4
        JSAPI --> API5
    end

    subgraph "Bridge Layer"
        RNBridge["React Native Bridge"]:::bridge
        
        subgraph "Bridge Implementations"
            AndroidBridge["Android Bridge"]:::bridge
            iOSBridge["iOS Bridge"]:::bridge
            WindowsBridge["Windows Bridge"]:::bridge
        end
    end

    subgraph "Native Implementations Layer"
        iOSImpl["iOS Implementation"]:::native
        AndroidImpl["Android Implementation"]:::native
        WindowsImpl["Windows Implementation"]:::native
    end

    subgraph "Storage Classes"
        BS["Backed Up Storage"]:::storage
        IS["Important Storage"]:::storage
        AS["Auxiliary Storage"]:::storage
        TS["Temporary Storage"]:::storage
    end

    subgraph "Testing Infrastructure"
        IntegrationTests["Integration Tests"]:::test
        AndroidTests["Android Unit Tests"]:::test
        iOSTests["iOS Integration Tests"]:::test
    end

    subgraph "Platform Configuration"
        AndroidConfig["Android Manifest"]:::config
        iOSConfig["iOS Project Config"]:::config
        WindowsConfig["Windows Project Config"]:::config
    end

    subgraph "Documentation"
        APIRef["API Reference"]:::docs
    end

    %% Connections
    JSAPI -.-> RNBridge
    RNBridge --> AndroidBridge & iOSBridge & WindowsBridge
    AndroidBridge --> AndroidImpl
    iOSBridge --> iOSImpl
    WindowsBridge --> WindowsImpl
    
    AndroidImpl --> BS & IS & AS & TS
    iOSImpl --> BS & IS & AS & TS
    WindowsImpl --> BS & IS & AS & TS

    %% Click Events
    click JSAPI "https://github.com/hnq90/react-native-filesystem-v1/blob/master/modules/FileSystem.js"
    click iOSImpl "https://github.com/hnq90/react-native-filesystem-v1/blob/master/ios/RNFileSystem/RNFileSystem.m"
    click AndroidImpl "https://github.com/hnq90/react-native-filesystem-v1/blob/master/android/src/main/java/com/benwixen/rnfilesystem/RNFileSystem.java"
    click WindowsImpl "https://github.com/hnq90/react-native-filesystem-v1/blob/master/windows/RNFileSystem/RNFileSystemModule.cs"
    click AndroidBridge "https://github.com/hnq90/react-native-filesystem-v1/blob/master/android/src/main/java/com/benwixen/rnfilesystem/RNFileSystemPackage.java"
    click iOSBridge "https://github.com/hnq90/react-native-filesystem-v1/blob/master/ios/RNFileSystem/RNFileSystem.h"
    click WindowsBridge "https://github.com/hnq90/react-native-filesystem-v1/blob/master/windows/RNFileSystem/RNFileSystemPackage.cs"
    click IntegrationTests "https://github.com/hnq90/react-native-filesystem-v1/blob/master/tests/integration-test/FileSystemTest.js"
    click AndroidTests "https://github.com/hnq90/react-native-filesystem-v1/blob/master/tests/android/app/src/test/java/com/benwixen/rnfilesystem/RNFileSystemUnitTests.java"
    click iOSTests "https://github.com/hnq90/react-native-filesystem-v1/blob/master/tests/ios/RNFileSystemIntegrationTests/RNFileSystemIntegrationTests.m"
    click AndroidConfig "https://github.com/hnq90/react-native-filesystem-v1/blob/master/android/src/main/AndroidManifest.xml"
    click iOSConfig "https://github.com/hnq90/react-native-filesystem-v1/blob/master/ios/RNFileSystem.xcodeproj/project.pbxproj"
    click WindowsConfig "https://github.com/hnq90/react-native-filesystem-v1/blob/master/windows/RNFileSystem/RNFileSystem.csproj"
    click APIRef "https://github.com/hnq90/react-native-filesystem-v1/blob/master/docs/reference.md"
```
