This repository has been archived by the owner on Nov 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" dir="ltr"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>TML</title> | ||
<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs@2/webcomponents-loader.min.js"></script> | ||
<script type="module" src="https://cdn.jsdelivr.net/gh/zerodevx/zero-md@1/src/zero-md.min.js"></script> | ||
</head> | ||
<body> | ||
<zero-md src="index.md"></zero-md> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
## TML: Simple-use YAML data storage | ||
|
||
> TML is a easy to use package for data manipulation | ||
- **Docs** [docs](https://terracrow.github.io/tml) | ||
- **NPM** [npm](https://npmjs.com/tml-db) | ||
|
||
### Installation | ||
```sh | ||
# npm | ||
npm install --save tml-db | ||
|
||
# yarn | ||
yarn add tml-db | ||
|
||
# clone source code | ||
git clone https://github.com/Terracrow/tml.git | ||
``` | ||
|
||
### Examples | ||
> Initialize and set a value in a key | ||
```typescript | ||
// #test.js | ||
|
||
// import TMLDriver | ||
import { TMLDriver } from 'tml'; | ||
|
||
// data to be stored | ||
const data = [ | ||
{ | ||
id: 1234, | ||
allowed: true | ||
}, | ||
{ | ||
id: 2341, | ||
allowed: false | ||
} | ||
]; | ||
|
||
// create a database connection | ||
const tml = new TMLDriver({ | ||
limit: 100 // number of files allowed | ||
customDir: 'tml' // set custom output path or put 'tml' | ||
}); | ||
|
||
// set 'data[]' in 'access_perms.yml' | ||
tml.set({ | ||
key: 'access_perms', | ||
value: data | ||
}); | ||
|
||
|
||
/** Output (access_perms.yml) | ||
* --- | ||
- id: 1234 | ||
allowed: true | ||
- id: 2341 | ||
allowed: false | ||
*/ | ||
``` | ||
|
||
> Get or delete data | ||
```typescript | ||
// #test.js | ||
|
||
// get the value of a key | ||
const usersPerms = db.get('access_perms'); | ||
|
||
// delete data | ||
db.delete('access_perms'); | ||
``` | ||
|
||
--- | ||
***This project is not finished and can present some bugs.*** | ||
|
||
>Made by Terracrow | 1.0.0 |
Empty file.