Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'

This commit is contained in:
Bjørn Erik Pedersen
2025-04-10 13:04:51 +02:00
987 changed files with 12379 additions and 14083 deletions

View File

@@ -3,19 +3,15 @@ title: os.ReadFile
description: Returns the contents of a file.
categories: []
keywords: []
action:
aliases: [readFile]
related:
- functions/os/FileExists
- functions/os/Getenv
- functions/os/ReadDir
- functions/os/Stat
returnType: string
signatures: [os.ReadFile PATH]
params:
functions_and_methods:
aliases: [readFile]
returnType: string
signatures: [os.ReadFile PATH]
aliases: [/functions/readfile]
---
The `os.ReadFile` function attempts to resolve the path relative to the root of your project directory. If a matching file is not found, it will attempt to resolve the path relative to the [`contentDir`](/getting-started/configuration#contentdir). A leading path separator (`/`) is optional.
The `os.ReadFile` function attempts to resolve the path relative to the root of your project directory. If a matching file is not found, it will attempt to resolve the path relative to the [`contentDir`](/configuration/all/#contentdir). A leading path separator (`/`) is optional.
With a file named README.md in the root of your project directory: