Capy-Bearer Documentation

file_get_contents

host call

Capy

function file_get_contents(path : string) string

Description

file_get_contents reads a complete file into a string. Use it for a small file that fits in one value. Use file_open and file_read for incremental reads.

Parameters

path : path of the file to read

Return Values

The file content, or "" when Capy cannot read the file.

Note

An empty file and an unreadable file both return "". Use file_exists when you must distinguish them.

Example

Capy

file_put_contents("/tmp/doc-get.txt", "hello")
print(file_get_contents("/tmp/doc-get.txt"), "\n")