README
sndb is a simple node.js database
it will write your data to a json file
const db = require("sndb")
try{
db.mkdb(__dirname+"/testdb") //will make a database.
}catch(err){
//if database is already made it will give a error, catch it.
}
db.setdata(0,__dirname+"/testdb",'hi') //set data in database (index position, database location , data)
//data: ['hi']
db.dbsize(__dirname+"/testdb")// will give you the size of the array
//output:1
//set data on the end of array
db.setdata(db.dbsize(__dirname+"/testdb"),__dirname+"/testdb",'hi2')//put in the first the array lengt en it will put th data on the end of the array
//data: ['hi','hi2']
//read data form database
db.readdb(__dirname+"/testdb",0)// output: 'hi'
db.readdb(__dirname+"/testdb",1)// output: 'hi2'
//remove item
db.rm(__dirname+"/testdb",0)// (database , index)
//data:['hi2']
//replace data
db.rm(__dirname+"/testdb",0,'hallo')// (database , index, replace data)
//data:['hallo']
for (i=0;i<db.dbsize(__dirname+"testdb");i++){
db.readdb(__dirname+"/testdb",i)
//read all data in db
}