method decode

Documentation for method decode, assembled from the following types:

role Blob

From Blob

(Blob) method decode

Defined as:

multi method decode(Blob:D: Str:D $encoding = 'UTF-8' --> Str:D)

Applies an encoding to turn the blob into a Str.

my Blob $blob = "string".encode('utf-8');
say $blob.decode('utf-8'); # OUTPUT: «string␤» 

On malformed utf-8 .decode will throw X::AdHoc. To handle sloppy utf-8 use utf8-c8.