S3_File.read_text
read_textencoding on_problems
Aliases: load text
, open text
Documentation
Reads the whole file into a Text
, with specified encoding.
Arguments
encoding
: The text encoding to decode the file with. Defaults to UTF-8.on_problems
: Specifies the behavior when a problem occurs during the function.
Returns
- The contents of the file as
Text
decoded with the specified encoding.
Errors
- If the bucket does not exist, an
S3_Bucket_Not_Found
error is thrown. - If the target is a directory, an
Illegal_Argument
error is thrown. - If the file does not exist, a
File_Error.Not_Found
error is thrown. - If the access to the object is forbidden, an
S3_Error.Access_Denied
error is thrown. - If there is a problem decoding the byte stream to text, then an
Encoding_Error
will be raised following theon_problems
behavior.