# `IEC60870.FileService.TransparentFile`
[🔗](https://github.com/Ultraluv/ex_iec60870/blob/main/lib/iec60870/file_service/provider.ex#L1)

Represents a file composed of one or more binary sections for IEC 60870-5-101/104 File Transfer
(`CS101_IFileProvider` / `CS101_TransparentFile` in `cs101_file_service.h`).

# `t`

```elixir
@type t() :: %IEC60870.FileService.TransparentFile{
  ca: non_neg_integer(),
  created_at: IEC60870.Types.CPTime.CP56Time2a.t(),
  data: binary() | nil,
  ioa: non_neg_integer(),
  name: String.t() | nil,
  nof: non_neg_integer(),
  on_complete: (boolean() -&gt; any()) | nil,
  sections: [binary()],
  sof: non_neg_integer()
}
```

# `add_section`

```elixir
@spec add_section(t(), binary()) :: t()
```

# `file_size`

```elixir
@spec file_size(t()) :: non_neg_integer()
```

# `get_segment_data`

```elixir
@spec get_segment_data(t(), non_neg_integer(), non_neg_integer(), non_neg_integer()) ::
  {:ok, binary()} | :error
```

Extracts a segment binary from `section_index` (0-based) starting at `offset` with `size`.

# `new`

```elixir
@spec new(non_neg_integer(), binary()) :: t()
```

Creates a new `TransparentFile` with `(nof, data)`.

# `new`

```elixir
@spec new(non_neg_integer(), String.t() | binary(), binary() | keyword()) :: t()
```

Creates a new `TransparentFile` with `(nof, name, data)` or `(nof, data, opts)`.

# `new`

```elixir
@spec new(non_neg_integer(), String.t(), binary(), keyword()) :: t()
```

Creates a new `TransparentFile` with `(nof, name, data, opts)`.

# `new`

```elixir
@spec new(
  non_neg_integer(),
  non_neg_integer(),
  non_neg_integer(),
  binary() | [binary()],
  keyword()
) ::
  t()
```

Creates a new `TransparentFile` from a single binary or a list of section binaries.

# `section_size`

```elixir
@spec section_size(t(), non_neg_integer()) :: non_neg_integer()
```

Returns the byte size of section `section_index` (0-based), or `0` if out of range.

# `to_binary`

```elixir
@spec to_binary(t()) :: binary()
```

Concatenates all sections into a single binary.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
