For the complete documentation index, see llms.txt. This page is also available as Markdown.

FileReadBinary

Reads the contents of a file and returns it as a string or binary object.

When called with a file path (string, Path, or File), the entire file is read from disk. HTTP URLs are also supported as string paths. When called with an open BoxFile object (from {@code fileOpen()}), the remaining content is read from the current stream position to EOF. For text mode files, returns a String. For binary mode files, returns a byte[]. The caller is responsible for closing the file object afterward.

Method Signature

FileReadBinary(filepath=[any], charsetOrBufferSize=[string], charset=[string], buffersize=[string])

Arguments

Argument
Type
Required
Description
Default

filepath

any

true

A file path (string, Path, File, or HTTP URL) to read entirely, or an open BoxFile object to read remaining content from.

charsetOrBufferSize

string

false

Either the charset to use when reading the file, or the buffer size. Only applies to path-based reads.

charset

string

false

The explicit charset to use when reading the file. Only applies to path-based reads.

buffersize

string

false

The explicit buffer size to use when reading the file. Only applies to path-based reads.

Examples

Last updated

Was this helpful?