# PlainNotebook

"PlainNotebook" is used for managing files **without** file extensions (such as `.env`, `.gitignore`, etc.)

{% hint style="danger" %}
We are **not** liable for anything you edit or manage maliciously. Be careful when editing certain files such as `.env`.&#x20;
{% endhint %}

## Usage

### Setup

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

const gitignore = new Nodebook.PlainNotebook('.gitignore');
```

{% hint style="info" %}
A lot of these methods are simiar to [Nodebook](/default-classes/default.md), even though it is not extended by it.
{% endhint %}

**fileName(options)**

object `options`:

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

**Return**: The file name.

```javascript
gitignore.fileName({ lower: false });
// returns ".gitignore"
```

**resetFile()**

Resets the file.

```javascript
gitignore.resetFile();
// resets .gitignore
```

**deleteFile(delay)**

Deletes the file

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

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

gitignore.deleteFile(10);
// Deletes the file in 10 seconds
```

**fetchLine(line)**

Fetches an existing line's content.

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

```javascript
gitignore.fetchLine(3);
// fetches the third line

gitignore.fetchLine(10);
// fetches the tenth 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
gitignore.deleteLine(15);
// sets the fifteenth 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
gitignore.editLine(1, 'node_modules/');
// sets the first line to 'node_modules/'
```

**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
gitignore.addLine('package-lock.json');
// adds 'Yippi Ki Yay!' to the next line
```

**content()**

Returns the file's content into a string.

```javascript
console.log(gitignore.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/text/plain.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.
