# Nodebook

These are the default methods for the class "Nodebook."

## Usage

### Nodebook

{% hint style="info" %}
Nodebook has a default class in case you want to edit files that do not have their own custom formatting.
{% endhint %}

#### Setup

```javascript
const Nodebook = require('node-notebook');

const myNotebook = new Nodebook.Nodebook('file name', 'txt');
```

**fileName(options)**

object `options`:

* `options.lower` - Whether or not the name should be turned to lower case.

**Return**: The file name.

```javascript
myNotebook.fileName({ lower: false });
// returns "file_name.txt"
```

**resetFile()**

Resets the file.

```javascript
myNotebook.resetFile();
// resets file_name.txt
```

**deleteFile(delay)**

Deletes the file

number `delay`: Sets how many **seconds** before deleting the file.

```javascript
myNotebook.deleteFile();
// Deletes the file instantly

myNotebook.deleteFile(3);
// Deletes the file in 3 seconds
```

**fetchLine(line)**

Fetches an existing line's content.

number `line`: The line number to get the information from.

```javascript
myNootebook.fetchLine(1);
// fetches the first line

myNotebook.fetchLine(5);
// fetches the fifth line
```

**Return**: The line content.

**deleteLine(line)**

Sets an existing line in the file to empty.

number `line`: The line number to make empty.

```javascript
myNotebook.deleteLine(1);
// sets the first line empty
```

**editLine(line, key)**

Replaces an existing line with a new string.

number `line`: The line number to set it to.

string `key`: The string that will replace the line.

```javascript
myNotebook.editLine(1, 'Welcome!');
// sets the first line to 'Welcome!'
```

**addLine(key)**

Adds a string at the next available line in the file.

string `key`: The string to add at the next available line.

```javascript
myNotebook.addLine('Yippi Ki Yay!');
// adds 'Yippi Ki Yay!' to the next line
```

**content()**

Returns the file's content into a string.

```javascript
console.log(myNotebook.content());
// should log the file's content
```


---

# 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://nodebook.js.org/default-classes/default.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.
