<commit_before># LHTML Document API

These are the functions available to authors of LHTML documents available in the `window.LHTML` namespace (as shown in the examples).

| Function/Variable | Short description |
|---|---|
| [`fs.listdir(...)`](#fslistdir) | List contents of the zip |
| [`fs.readFile(...)`](#fsreadfile) | Read a file from the document zip |
| [`fs.remove(...)`](#fsremove) | Remove a file/dir from the document zip |
| [`fs.writeFile(...)`](#fswritefile) | Overwrite a file within the document zip |
| [`on(...)`](#on) | Listen for events |
| [`saving.defaultSaver`](#savingdefaultsaver) | The function that will be used for saving if `registerSaver` isn't called |
| [`saving.disableFormSaving()`](#savingdisableformsaving) | Called to disable automatic form saving |
| [`saving.registerSaver(...)`](#savingregistersaver) | Register a function to determine how the document is saved |
| [`saving.save()`](#savingsave) | Programatically start saving the current document |
| [`saving.setDocumentEdited(...)`](#savingsetdocumentedited) | Indicate that there are changes to be saved |
| [`suggestSize(...)`](#suggestsize) | Attempt to resize the document's window |

### `fs.listdir(...)`

List the full contents of the LHTML zip file.  

Spec: `fs.listdir([path,] [options])`

| Parameter | Description |<commit_msg>Listdir explained a little better<commit_after># LHTML Document API

These are the functions available to authors of LHTML documents available in the `window.LHTML` namespace (as shown in the examples).

| Function/Variable | Short description |
|---|---|
| [`fs.listdir(...)`](#fslistdir) | List contents of the zip |
| [`fs.readFile(...)`](#fsreadfile) | Read a file from the document zip |
| [`fs.remove(...)`](#fsremove) | Remove a file/dir from the document zip |
| [`fs.writeFile(...)`](#fswritefile) | Overwrite a file within the document zip |
| [`on(...)`](#on) | Listen for events |
| [`saving.defaultSaver`](#savingdefaultsaver) | The function that will be used for saving if `registerSaver` isn't called |
| [`saving.disableFormSaving()`](#savingdisableformsaving) | Called to disable automatic form saving |
| [`saving.registerSaver(...)`](#savingregistersaver) | Register a function to determine how the document is saved |
| [`saving.save()`](#savingsave) | Programatically start saving the current document |
| [`saving.setDocumentEdited(...)`](#savingsetdocumentedited) | Indicate that there are changes to be saved |
| [`suggestSize(...)`](#suggestsize) | Attempt to resize the document's window |

### `fs.listdir(...)`

List the contents of the LHTML zip file.  If called without arguments, you will receive a list of every file within the LHTML zip file.

Spec: `fs.listdir([path,] [options])`

| Parameter | Description |
{'fraction_non_alphanumeric': 0.15694744420446363, 'fraction_numerical': 0.0, 'mean_word_length': 4.850526315789474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7596442', 'n_tokens_mistral': 837, 'n_tokens_neox': 778, 'n_words': 280}