# getAsBytes

abstract fun getAsBytes(): Provider<Array<Byte>>(source)

Gets a provider of the entire file contents as a single byte array.

The file is read only once and only when the value is requested for the first time.

The returned provider won't have a value, i.e., isPresent will return `false` when:

- the underlying file does not exist;
- this FileContents is connected to a Provider`<`RegularFile`>` with no value;

When the underlying file exists but reading it fails, the ensuing exception is permanently propagated to callers of get, getOrElse, getOrNull and isPresent.

#### Return

provider of the entire file contents as a single byte array.

#### Since

6.1