> ## Documentation Index
> Fetch the complete documentation index at: https://starrycodes.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# File - IO Utility Extensions

>  Powerful extensions for dart:io.File to simplify size formatting, path manipulation, and type checking for local files.

<Warning>
  Methods like `fileFormattedSize()` and `fileToBase64String()` use synchronous I/O (`lengthSync`, `readAsBytesSync`) and should be run off the main thread (e.g., in an `Isolate` or `compute`) for large files to prevent UI jank.
</Warning>

<br />

<Steps titleSize="h3">
  <Step title="🔗 Path & Naming">
    <ResponseField name="filePath()" type="String">
      Retrieves the absolute path of the file.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final path = file.filePath();

      //  Output: /data/user/0/app.name/cache/temp.txt
      ```
    </ResponseField>

    <ResponseField name="fileExtension()" type="String">
      Retrieves the file extension (the part after the last dot), e.g., "png", "pdf".

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      print(File('/img/photo.png').fileExtension()); // png
      ```
    </ResponseField>

    <ResponseField name="fileNameWithoutExtension()" type="String">
      Retrieves the file name without the extension. "pdf".

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      print(File('/docs/report.pdf').fileNameWithoutExtension()); // report
      ```
    </ResponseField>
  </Step>

  <Step title="🖼️ Content & Type Checks">
    <ResponseField name="fileToBase64String()" type="String">
      Reads the file contents synchronously and converts them to a `Base64` encoded string.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final base64 = file.fileToBase64String();
      ```
    </ResponseField>
  </Step>
</Steps>
