Edit

How to edit Record content and attributes.

Save Content

const record = db.get('tag')
record.content.KEY = "VALUE"
// or record.content = "VALUE"
record.save()

Append to Record

db.get('tag').append(content)
Parameter
About
Type
Required

content

The content to add

Any

Truncate Record

db.get('tag').truncate(length)
Parameter
About
Type
Required

length

New file length

Number

Edit Record Content

This will overwrite your record with the content provided.

db.get('tag').edit(content)
Parameter
About
Type
Required

tag

The Record's tag

String

content

The content to overwrite with

Any (must match file extension)

Modify a Key

JSON Only

This function only modifies objects.

db.get('tag').modify(key, value)
Parameter
About
Typr
Required

key

The key to set the value to

String

value

The value to set the key to

Any

Modify a Record's Tag

db.get('old_tag').setTag('new_tag')
Parameter
About
Type
Required

old_tag

The current tag of the Record.

String

new_tag

The new tag you want for the Record.

String

Overwrite from another Record

db.get('tag').syncWith('_tag')
Parameter
About
Type
Required

_tag

The tag of the Record you want to get the content from.

String

Beautify JSON

JSON Only

This function only modifies objects.

db.get('tag').beautify(replacer, space)
Parameter
About
Type
Required

replacer

A function that transforms the results.

Function

space

Adds indentation, white space, and line break characters to the return-value to make it easier to read. Default: 2

Number

Empty Record

Emptying a Record deletes the Record content but preserves the file.

db.get('tag').empty()

Check if a Record is empty

db.get('tag').isEmpty

Last updated