# Stream Methods

{% hint style="info" %}
The stream methods are only available for the LocalProvider currently.
{% endhint %}

### stream

Returns a Java stream of the file using non-blocking IO classes. The stream will represent every line in the file so you can navigate through it.

```javascript
/**
 * @path The path to read all the files with
 *
 * @return Stream object: See https://apidocs.ortussolutions.com/coldbox-modules/cbstreams/1.1.0/index.html
 */
function stream( required path );

// Example
disk.stream( expandPath( "datadump.txt" ) );
```

### streamOf

Create a Java stream of the incoming array of files or directories.&#x20;

```javascript
/**
 * @target The target array of files/directories to generate a stream of
 *
 * @return Stream object: See https://apidocs.ortussolutions.com/coldbox-modules/cbstreams/1.1.0/index.html
 */
function streamOf( required array target ){
	
// Example
disk.streamOf( disk.files( "my.path" ) )
	.filter( function( item ){
		return item.startsWith( "a" );
	} )
	.forEach( function( item ){
		writedump( item );	
	} );
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cbfs.ortusbooks.com/usage/disk-usage/stream-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
