mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
Merge branch 'master' into sea
This commit is contained in:
commit
b7c2d583b2
@ -62,9 +62,10 @@ function Store(opt){
|
||||
|
||||
var store = function Store(){};
|
||||
store.put = function(file, data, cb){
|
||||
fs.writeFile(opt.file+'.tmp', data, function(err, ok){
|
||||
var random = Math.random().toString(36).slice(-3)
|
||||
fs.writeFile(opt.file+'-'+random+'.tmp', data, function(err, ok){
|
||||
if(err){ return cb(err) }
|
||||
fs.rename(opt.file+'.tmp', opt.file+'/'+file, cb);
|
||||
fs.rename(opt.file+'-'+random+'.tmp', opt.file+'/'+file, cb);
|
||||
});
|
||||
};
|
||||
store.get = function(file, cb){
|
||||
|
Loading…
x
Reference in New Issue
Block a user