Obsidian Mobile (Android): adapter.writeBinary on large files never resolves and repeatedly appends data

Steps to reproduce

  1. On Obsidian Mobile (Android), create a new sandbox vault (no third-party plugins, default theme, no CSS snippets).

  2. Install a minimal test plugin that exposes a single command, e.g. “Write large test binary”.

  3. In the plugin’s command handler, call adapter.writeBinary with a large ArrayBuffer once:

     async writeTestLargeFile() {
         const adapter = this.app.vault.adapter;
    
         const size = 50 * 1024 * 1024; // 50 MB
         const buffer = new Uint8Array(size);
         buffer.fill(1);
         const targetPath = "test-large.bin";
    
         console.log(`writeTestLargeFile: start adapter write ${targetPath}, bytes=${buffer.byteLength}`);
         await adapter.writeBinary(targetPath, buffer);
         console.log(`writeTestLargeFile: done adapter write ${targetPath}, bytes=${buffer.byteLength}`);
       }
    
  4. Reload the plugin and run the command once.

  5. While Obsidian is still running, inspect test-large.bin from an external file manager (or via adb/terminal) and watch its size.

  6. Observe that:

    • the console log shows writeTestLargeFile: start ... exactly once,

    • writeTestLargeFile: done ... is never printed,

    • the file keeps growing in size by ~50 MB (50 → 100 → 150 → 200 MB, etc.) until Obsidian is closed.

Did you follow the troubleshooting guide? [Y/N]

Y

Expected result

  1. adapter.writeBinary(targetPath, buffer) overwrites the file contents with the provided buffer exactly once.
  2. The returned Promise resolves, and the “done” log line is printed.
  3. The resulting file size is equal to the size of the buffer (e.g. ~50 MB) and remains stable.

Actual result

  1. The Promise returned by adapter.writeBinary never resolves (the “done” log is never printed).
  2. The target file’s size keeps increasing over time in increments equal to the buffer size:
    • if the buffer is ~50 MB, the file grows 50 → 100 → 150 → 200 MB, etc.
  3. This happens even though the test command is invoked exactly once (the “start” log appears only once).
  4. The growth stops only when Obsidian Mobile is closed.

Environment

  1. Obsidian Mobile 1.10.5
  2. Platform: Android 12
  3. Vault location: Device storage
  4. Sandbox vault with only the minimal test plugin above, no third-party plugins, default theme, no CSS snippets.

Additional information

  1. The same test code works as expected on desktop (Obsidian for desktop with FileSystemAdapter): the file is written once, the Promise resolves, and the file size is stable.
  2. The issue appears specific to Obsidian Mobile’s CapacitorAdapter implementation of DataAdapter.writeBinary when writing large binary blobs (tens of MB).
  3. The growth pattern (file size increased by exactly the buffer size, while the write Promise never resolves) suggests that the underlying mobile filesystem write operation is repeatedly appending the same data block without truncating, and without propagating either a success or an error back to the JavaScript layer.