New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sl-code-lords/github-db

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sl-code-lords/github-db

github repository database

1.1.0
latest
Source
npm
Version published
Maintainers
4
Created
Source

Github DataBase

Github DataBase

Status GitHub Issues GitHub Pull Requests License

github repository database

📝 Table of Contents

🧐 About

use github repository as database

🏁 Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Installing

yarn add @sl-code-lords/github-db

or

npm i @sl-code-lords/github-db

🎈 Usage

var Github_db = require('@sl-code-lords/github-db')
var config={ github_token: 'token', user_name:'user_name', repo:'test_github_db',is_private_repo:true }
var git = new Github_db(config)

Config

const config = {
    github_token, // your github token
    user_name, // your github username
    repo, // repo name for github db
    commit_message, // commit massage
    committer_mail, // mail of any github account for commit
    committer_name, // name for committer
    use_template, // if you have template repo use_template : 'username/repo'
    is_private_repo // if true repo will gen as private
}

Connecting..

const is_conn = await git.connect()
//is_conn
true

File Model

//init new file
var File = git.File('hello.txt','Init','Files/')
        
// upload file to github
var init = await File.upload_data(Buffer.from('test file upload', 'utf-8'))
        
//delete File From Github
var del = await File.delete_file()
//init
true

//del
true

String Model

var password = '' // password for enc file method

//init new String Model
var session = git.stringModel('session','Init','DB/',password)

// add new string
var add = await session.update_data('Hello I Am Ravindu Manoj -')

// + add string
var second_add = await session.update_data('@ravindu01manoj')

// replace new string
var third_add = await session.update_data('replacement add',true)

// get data from model
var get_data = await session.get_data()

// delete model
var del = await session.delete_model()
//add
Hello I Am Ravindu Manoj -

//second_add
Hello I Am Ravindu Manoj -@ravindu01manoj

//third_add
replacement add

//get_data
replacement add

//del
true

Array Model

var password = '' // password for enc file method

//init new Array Model
var list = git.arrayModel('list','Init','DB/',password)

// add new array
var add = await list.update_data([1,'mango'])

// + add array
var second_add = await list.update_data(['banana','apple'])

// replace new array
var third_add = await list.update_data(['cat','dog','ant'],true)

// get data from model
var get_data = await list.get_data()

// delete model
var del = await list.delete_model()
//add
[ 1, 'mango' ]

//second_add
[ 1, 'mango', [ 'banana', 'apple' ] ]

//third_add
[ 'cat', 'dog', 'ant' ]

//get_data
[ 'cat', 'dog', 'ant' ]

//del
true

Object Model

var password = '' // password for enc file method

//init new Object Model
var item = git.objectModel('item','Init','DB/',password)

// add new object
var add = await item.update_data({name : 'Ravindu',age:'21'})

// + add object
var second_add = await item.update_data({country : 'sri_lanka',age:22,language : 'sinhala'})

// replace new object
var third_add = await item.update_data({game:'cricket',year: 2023},true)

// get data from model
var get_data = await item.get_data()

// delete model
var del = await item.delete_model()
//add
{ name: 'Ravindu', age: '21' }

//second_add
{ name: 'Ravindu', age: 22, country: 'sri_lanka', language: 'sinhala' }

//third_add
{ game: 'cricket', year: 2023 }

//get_data
{ game: 'cricket', year: 2023 }

//del
true

✍️ Authors

See also the list of contributors who participated in this project.

Keywords

github

FAQs

Package last updated on 26 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts