Skip to content

Instantly share code, notes, and snippets.

@raliste
Last active April 5, 2016 18:50
Show Gist options
  • Save raliste/16c43ddc6cd706bd2435508ea84edfb8 to your computer and use it in GitHub Desktop.
Save raliste/16c43ddc6cd706bd2435508ea84edfb8 to your computer and use it in GitHub Desktop.
// esto lo podrias hacer en el archivo de file retrieval
var storage = require('./utils/storage');
var files_path = join(common.system.paths.config, 'files.db');
storage.init(files_path);
var una_funcion = function(cb) {
// Guardar un dato
storage.set('nombre_del_archivo', {ultimo_byte: 321321, otra_info: "hola"}, cb);
// Obtener un dato
storage.get('nombre_del_archivo'); // {ultimo_byte: 321321, otra_info: "hola"}
// Borrar un dato
storage.del('nombre_del_archivo');
// Obtener todos los datos
storage.all(function(err, obj) {
console.log(obj) // nombre_del_archivo
console.log(storage.get(obj)) // {ultimo_byte: 321321, otra_info: "hola"}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment