# Events

| Event            | Callback Arguments              | About                                                                               |
| ---------------- | ------------------------------- | ----------------------------------------------------------------------------------- |
| start            | Directory path & file extension | Fires when Dubnium is initialized.                                                  |
| create           | Tag & content                   | Fires when a Record is created.                                                     |
| delete           | Tag & content                   | Fires when a Record is deleted.                                                     |
| edit             | Tag, old & new content          | Fires when a Record's value changes.                                                |
| retagged         | Old & new tag                   | Fires when a Record's tag changes.                                                  |
| wipe             | Directory path                  | Fires when the database is wiped.                                                   |
| close            | Directory path                  | Fires when the database is closed.                                                  |
| delete\_old      | Options                         | Fires when `deleteOld` is called. (Will also fire `delete` for any Records deleted) |
| dir              | Directroy path                  | Fires when the directory is created.                                                |
| move             | Tag, old & new directory        | Fires when a Record is moved.                                                       |
| clone            | Tag, target                     | Fires when a Record is cloned.                                                      |
| symlink          | Tag & path to symlink           | Fires when a Symlink is created.                                                    |
| sync             | Tag & tag of synced with        | Fires when `syncWith` is called.                                                    |
| delete\_large    | Options                         | Fires when [`deleteLarge()`](/3/api/manage.md#delete-large-records) is called.      |
| append           | Tag, content                    | Fires when content is appended.                                                     |
| truncate         | Tag, length                     | Fires when a Record is truncated.                                                   |
| fs               | Function, tag, args             | Fires when [`fs()`](/3/api/miscellaneous.md#fs) is called.                          |
| beautify         | Tag, replacer, space            | Fires when JSON is beautified.                                                      |
| exec             | Command & callback              | Fires when a bash command is ran via [`db.exec()`](/3/api/miscellaneous.md#bash).   |
| save             | Tag & content                   | Fires when a record is saved. This will also fire the `edit` event.                 |
| stop\_versioning | Options                         | Fires when you stop recording versions.                                             |
| empty            | Record tag                      | Fires when a Record is emptied.                                                     |

{% hint style="info" %}
Any events from `fs.watch()` will be fired if [versioning](/3/api/versioning.md) is enabled.
{% endhint %}

### Example

{% code lineNumbers="true" %}

```javascript
db.on('create', (tag, content) => { console.log(`${tag} was created!`) })
```

{% endcode %}


---

# 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://db.coolstone.dev/3/events.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.
