mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
bug fix from nordicjs testing
This commit is contained in:
parent
5649accaf3
commit
b7eb0a956a
@ -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