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

# 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"
}
```
