21 lines
714 B
Plaintext
21 lines
714 B
Plaintext
:sig
|
|
String file_get_contents(String file_name)
|
|
|
|
:params
|
|
file_name : file name of file that should be read
|
|
return value : String containing the file's contents
|
|
|
|
:see
|
|
>sys
|
|
|
|
:content
|
|
Reads the file identified by `file_name` and returns it as a `String`.
|
|
|
|
The read transparently takes a shared file lock for the duration of the call. If another worker is writing the same file with `file_put_contents()` or `file_append()`, this read waits for that exclusive write lock to finish, so callers do not manage locks manually.
|
|
|
|
If the file cannot be read, this function returns an empty string.
|
|
## Related Concepts
|
|
|
|
- PHP: `file_get_contents()`
|
|
- JavaScript / Node.js: Node `fs.readFileSync()` or `fs.promises.readFile()`
|