galaxy-flatfile

1.0.0 • Public • Published

Galaxy-Flatfile

About

It is a flatfile storage library, developed by Galaxy. If you have questions or problems do not hesitate to contact us. Support

Usage

  1. First of all, before you start using the library, you must install it. Download
  2. Once downloaded you can start using it. Below you will find basic examples of how to use it.

Methods

Flatfile(file, directory) - To create a new flatfile

  • file (String) - The file name
  • directory (Path) - The directory

Flatfile#delete(file) - To delete a file

  • file (String) - The file name

Flatfile#add(key, value) - Add data to a path

  • key (String) - The data path
  • value (String, Integer, Boolean, Array) - The data value

Flatfile#rem(key) - Remove data from a path

  • key (String) - The data path

Flatfile#getKey(key) - Get data from path

  • key (String) - The data path

Flatfile#getSize(key) - Get data path size

  • key (String) - The data path

Example

const flatfile = require('simple-flatfile');
const file = new flatfile("users", __dirname);

if (!file.get("Users")){
    file.add("Users", {});
    file.add("Users.Alfreado", 60);
    file.add("Users.Lucas", 40);
}

console.log("Users: " + file.getKey("Users"));
console.log("Users amount: " + file.getSize("Users"));

if (file.getKey("Users.Alfreado") > 80)){
    file.add("Users.Alfreado", 0);
    console.log("The level of Alfreado has been reset because he reached the maximum");
}

Package Sidebar

Install

npm i galaxy-flatfile

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

6.58 kB

Total Files

4

Last publish

Collaborators

  • alexito2060