Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: document missing options #110

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 49 additions & 1 deletion documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ Use this to limit the maximum depth fdir will crawl to before stopping.
const crawler = new fdir().withMaxDepth(5);
```

### `withMaxFiles(number)`

Use this to limit the maximum number of files fdir will crawl to before stopping.

**Usage**

```js
const crawler = new fdir().withMaxFiles(100);
```

### `withFullPaths`

Use this to get full absolute paths in the output.
Expand All @@ -156,6 +166,28 @@ Use this to get paths relative to the root directory in the output.
const crawler = new fdir().withRelativePaths();
```

### `withPathSeparator`

Use this to set the path separator in the output.

**Usage**

```js
const crawler = new fdir().withPathSeparator("/");
```

### `withAbortSignal(AbortSignal)`

Use this to pass an `AbortSignal` to the crawler.

**Usage**

```js
const controller = new AbortController();

const crawler = new fdir().withAbortSignal(controller.signal);
```

### `withErrors`

Use this if you want to handle all errors manually.
Expand Down Expand Up @@ -241,6 +273,19 @@ Applies a `glob` filter to all files and only adds those that satisfy it.
const crawler = new fdir().glob("./**/*.js", "./**/*.md");
```

### `globWithOptions(string[], Object)`

The same as `glob` but allows you to pass options to the matcher.

**Usage**

```js
// only get js and md files
const crawler = new fdir().globWithOptions(["**/*.js", "**/*.md"], {
strictSlashes: true
});
```

### `filter(Function)`

Applies a filter to all directories and files and only adds those that satisfy the filter.
Expand Down Expand Up @@ -373,14 +418,17 @@ type Options = {
includeDirs?: boolean;
normalizePath?: boolean;
maxDepth?: number;
maxFiles?: number;
resolvePaths?: boolean;
suppressErrors?: boolean;
group?: boolean;
onlyCounts?: boolean;
filters?: FilterFn[];
filters: FilterFn[];
resolveSymlinks?: boolean;
excludeFiles?: boolean;
exclude?: ExcludeFn;
relativePaths?: boolean;
pathSeparator: PathSeparator;
signal?: AbortSignal;
};
```
Loading