<commit_before># Findler: Filesystem Iteration with Persistable State

Findler is a Ruby library for iterating over a filtered set of files from a given
path, written to be suitable with concurrent workers and very large
filesystem hierarchies.

## Usage

```ruby
f = Findler.new "/Users/mrm"
f.append_extension ".jpg", ".jpeg"
iterator = f.iterator
iterator.next
# => "/Users/mrm/Photos/IMG_1000.JPG"
```

## Cross-process continuations

This should smell an awful lot like [hike](https://github.com/sstephenson/hike),
except for that last bit.

```Findler.iterator``` instances can be "paused" and "resumed" with ```to_yaml```.
The entire state of the iteration for the filesystem is returned, which can then
be pushed onto any durable storage, like ActiveRecord or Redis, or just a local file:

```ruby
File.open('state.yaml', 'w') { |f| f.write(iterator.to_yaml) }
```

To resume iteration:

```ruby
Findler::Iterator.from_yaml(IO.open('state.yaml'))
iterator.next
# => "/Users/mrm/Photos/IMG_1001.JPG"
```<commit_msg>don't confuse the reader with case insensitivity right off the bat<commit_after># Findler: Filesystem Iteration with Persistable State

Findler is a Ruby library for iterating over a filtered set of files from a given
path, written to be suitable with concurrent workers and very large
filesystem hierarchies.

## Usage

```ruby
f = Findler.new "/Users/mrm"
f.append_extension ".jpg", ".jpeg"
iterator = f.iterator
iterator.next
# => "/Users/mrm/Photos/img_1000.jpg"
```

## Cross-process continuations

This should smell an awful lot like [hike](https://github.com/sstephenson/hike),
except for that last bit.

```Findler.iterator``` instances can be "paused" and "resumed" with ```to_yaml```.
The entire state of the iteration for the filesystem is returned, which can then
be pushed onto any durable storage, like ActiveRecord or Redis, or just a local file:

```ruby
File.open('state.yaml', 'w') { |f| f.write(iterator.to_yaml) }
```

To resume iteration:

```ruby
Findler::Iterator.from_yaml(IO.open('state.yaml'))
iterator.next
# => "/Users/mrm/Photos/img_1001.jpg"
```
{'fraction_non_alphanumeric': 0.12541726275631854, 'fraction_numerical': 0.007629947544110634, 'mean_word_length': 4.977207977207978, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '434873', 'n_tokens_mistral': 694, 'n_tokens_neox': 642, 'n_words': 236}