# ls-stream

> readable stream of file paths + stat objects

Latest version **1.0.0** (published 2013-10-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install ls-stream
pnpm add ls-stream
yarn add ls-stream
bun add ls-stream
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2013-10-27 |
| First published | 2013-03-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Chris Dickinson |
| Maintainers | chrisdickinson |
| Keywords | ls, -R, stream |

## Links

- npm: https://www.npmjs.com/package/ls-stream
- Repository: https://github.com/chrisdickinson/ls-stream
- Issues: https://github.com/chrisdickinson/ls-stream/issues
- npm.io page: https://npm.io/package/ls-stream

## Dependencies (1)

- [through](https://npm.io/package/through.md) ~2.2.7

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2013-10-27
- 0.0.4 — 2013-08-12
- 0.0.3 — 2013-05-16
- 0.0.2 — 2013-03-18
- 0.0.1 — 2013-03-18

## README

# ls-stream

a readable stream of file and directories paths and entries.

```javascript
var ls = require('ls-stream')

ls('.git')
    .on('data', console.log.bind(console))

```

## API

#### ls([fs,] directory) -> ls stream

create a readable stream of entry objects.

will start emitting data on next tick unless paused.

users may optionally provide their own `fs` object if native `fs` is not
available for whatever reason (e.g., in browser).

#### 'data' Entry object

```javascript
{ path: "path/to/file-or-dir"
, stat: fs.Stat object }
```

#### Entry.ignore([bool=true]) -> undefined

If called on the same event loop turn as the event is
received, prevents recursing into this directory (or is
a no-op if the entry represents a file). Optionally takes
a single argument which defaults to `true` to set the
"ignored" status.

```javascript
var through = require('through')
  , ls = require('ls-stream')

ls('/path')
  .pipe(through(function(entry) {
    console.log(entry.path)
    if(entry.path == "/path/something") {
      // if we see "/path/something" *don't* list files
      // and dirs that it contains.
      entry.ignore()
    }
  }))

```

**Warning:** As aforementioned, this only works if the entry
is ignored on the same event loop turn. For example, the following
code would *fail* to ignore the given entry:

```javascript
// WARNING: this will not work:
ls('/path')
  .pipe(through(function(entry) {
    // by the time we tell the entry that it
    // should be ignored, `ls` has already
    // recursed into it!
    setTimeout(function() {
      entry.ignore()
    }, 0)
  }))
```

## license

MIT

---
_Source: https://npm.io/package/ls-stream · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
