---
schema_version: "1"
id: c6946ff7b0f3283cf9b480f720e735a0c12668c7ee10fb5f5042b99192e847ef
title: readLinesWith
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/latest/dw-binaries-functions-readlineswith.md
canonical_url: https://docs.mulesoft.com/dataweave/latest/dw-binaries-functions-readlineswith
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 108cdbc6c2fc514e3fb7efa1c4b7049319d44bb81956901a6ea875a3fbc4f10b
description: MuleSoft Documentation Site
release: "2.13"
latest: true
---
---
product: DataWeave
version: 2.13
is-latest-version: true
---

# readLinesWith

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## readLinesWith(content: Binary, charset: String): Array<String>

Splits the specified binary content into lines and returns the results in an array.

_Introduced in DataWeave version 2.2.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>content</code></p></td><td><p>Binary data to read and split.</p></td></tr><tr><td><p><code>charset</code></p></td><td><p>String representing the encoding to read.</p></td></tr></tbody></table>

### Example

This example transforms binary content, which is separated into new lines (`\n`), in a
comma-separated array.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Binaries
var content = read("Line 1\nLine 2\nLine 3\nLine 4\nLine 5\n", "application/octet-stream")
output application/json
---
{
   lines : (content readLinesWith "UTF-8"),
   showType: typeOf(content)
}
```

#### Output

```JSON
{
   "lines": [ "Line 1", "Line 2", "Line 3", "Line 4", "Line 5" ],
   "showType": "Binary"
}
```
