virtu-crud

1.1.9 • Public • Published

virtu-crud

Virtuba server-side crud command router for remote encrypted fileserver

Version:

Lastest version is at 1.1.9

Installations:

Install via npm

npm install virtu-crud

Install directly Clone the repository, in the project root type:

npm install 

Usage

    
var crud = require('virtu-crud'),
    // hash any text on the fly... 
    file_md5 = crud.toHash("test"),
    user_hash = crud.toHash("username"),
    // map should be a json file encrypted inside the user browser before being sent to webserver
    user_map = {"map": map}
    
// --- NEW VERSION ---
/////////////////////////////////////////////
var user_hash = crud.toHash("username")
var s = crud.session()

// create a queue (( if user already exist the queue will be loaded))
var userQueue = s.queue(user_hash)

// add some command on the fly
userQueue.create("", file_md5)
userQueue.read( file_md5)
userQueue.update(hash, file_md5)
userQueue.destroy( file_md5)

// you can add a user directly and save the user queue on the fly to update sessions object 
s.addUser(user_hash)
s.saveUser(userQueue)

// here is sent all queued commands and refrsh the queueobject
userQueue.send(user_map)

// async version of send , you can pass it a callback
userQueue.create("", file_md5)
userQueue.sendAsync(user_map, function(){
    // some code
    })

// You can also add command and refresh the queue without sending 
userQueue.create("", file_md5)
userQueue.refresh()

// --- OLD VERSION ---
//////////////////////////////////////////////////
// or asyncrononous with callback ... 
crud.toHash_async("test". function(err, hash){
    if (err){throw err}
    console.log(hash)

// add some actions on the fly... 
crud.add.create("", file_md5)
crud.add.read(file_md5)
crud.add.update(hash, file_md5)
crud.add.destroy(hash)

// Then send it all to command server async
crud.send(user_hash, user_map, function(err){
    if (err){ console.log(err)}
    return true
})

}//end of crud.toHash_async


Dependencies

    "js-md5": "",
    "aes256": "1.0.2",
    "chai": ""

Readme

Keywords

Package Sidebar

Install

npm i virtu-crud

Weekly Downloads

16

Version

1.1.9

License

none

Last publish

Collaborators

  • jpbeaudet