Read text

View as Markdown

Read a bounded UTF-8 text slice from a durable File. Use this when an automation flow needs text content without downloading the entire File.

Read a File

1const result = await bctrl.tools.call("files.read_text", {
2 fileId: "file_01JQXYZ8ABCD1234EFGH5678JK",
3 maxBytes: 262144,
4 maxLines: 10000,
5});
6
7console.log(result.text);
8console.log(result.truncated);

This Tool is synchronous and is not Runtime-bound. Use bctrl.files.content(fileId) when you need the complete binary content.

Request parameters

ParameterTypeRequiredDescription
fileIdFileIdYesDurable File to read.
maxBytesintegerNoMaximum bytes. Defaults to 262144; maximum 1048576.
maxLinesintegerNoMaximum lines. Defaults to 10000; maximum 50000.

Response

FieldTypeAlways presentDescription
fileIdFileIdYesFile that was read.
textstringYesUTF-8 text returned by the Tool.
bytesnumberYesNumber of bytes returned.
linesnumberYesNumber of lines returned.
truncatedbooleanYesWhether either limit truncated the result.

Next