# Miscellaneous

## Directory

### Change <a href="#change-dir" id="change-dir"></a>

{% code lineNumbers="true" %}

```javascript
db.config.dir = './new/dir'
```

{% endcode %}

### Make <a href="#make-dir" id="make-dir"></a>

{% code lineNumbers="true" %}

```javascript
db.dir()
```

{% endcode %}

### Get path <a href="#get-dir" id="get-dir"></a>

{% code lineNumbers="true" %}

```
db.dirPath
```

{% endcode %}

### Iterate

{% code lineNumbers="true" %}

```javascript
db.iterate(record => {})
```

{% endcode %}

<table><thead><tr><th>Parameter</th><th>About</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>callback</td><td>Callback</td><td>function</td><td>true</td></tr></tbody></table>

## Create Symlink to a Record <a href="#create-symlink" id="create-symlink"></a>

{% code lineNumbers="true" %}

```javascript
db.get('tag').symlink('./path/to/symlink') 
```

{% endcode %}

<table><thead><tr><th>Parameter</th><th>About</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>target</td><td>Path to a directory where the symlink will be created</td><td>String</td><td>true</td></tr></tbody></table>

## Get Record's Stats <a href="#get-stats" id="get-stats"></a>

{% code lineNumbers="true" %}

```javascript
db.get('tag').stats
```

{% endcode %}

## Content to String & JSON

{% code lineNumbers="true" %}

```javascript
db.get('tag').toString() // returns content as string
```

{% endcode %}

{% code lineNumbers="true" %}

```javascript
db.get('tag').toJSON() // returns content as an object, if possible
```

{% endcode %}

## End

If you want to *end* a string of methods, you can with `.end()`. It emits the [`end`](https://db.coolstone.dev/3/events) event and no methods can be added after it. **Note: this is not required.**

{% code lineNumbers="true" %}

```javascript
db.get("tag").overwrite(content).end()
```

{% endcode %}

## Exit&#x20;

If you wish to exit the Record editor API, call the `exit()` method and it will return the class.

{% code lineNumbers="true" %}

```javascript
db.get('tag').overwrite(content).exit().//any_class_function
```

{% endcode %}

## FS

Run any `fs` method on the Record or database.

{% tabs %}
{% tab title="Database" %}
{% code lineNumbers="true" %}

```javascript
db.fs('methodName', ...method_args)
```

{% endcode %}
{% endtab %}

{% tab title="Record" %}
{% code lineNumbers="true" %}

```javascript
db.get('tag').fs('methodName', ...method_args)
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Execute Bash <a href="#bash" id="bash"></a>

{% code lineNumbers="true" %}

```javascript
db.exec('command', (error, stdout) => {})
```

{% endcode %}

<table><thead><tr><th>Parameter</th><th>About</th><th>Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>command</td><td>The command (include arguments)</td><td>string</td><td>true</td></tr><tr><td>callback</td><td>Callback</td><td>function</td><td>true</td></tr></tbody></table>

## Internal Functions

Dubnium exports some internal functions that can be used in your project.

{% code lineNumbers="true" %}

```javascript
require('dubnium/functions')
```

{% endcode %}

## Aliases

Don't like the name we chose for a method? Set an alias!&#x20;

{% code lineNumbers="true" %}

```javascript
db.alias('alais_here', 'existing_function')
```

{% endcode %}

For example,

{% code overflow="wrap" lineNumbers="true" %}

```javascript
db.alias('val', 'getFromValue') // Allows you to call db.val() instead of db.getFromValue()
```

{% endcode %}
