git ssb

1+

Dominic / ssb-keys



Commit b174e25259d127acc249b76628b1e3c53cc0a354

Fix storage.js fallback logic to local-storage

`fs.readFileSync` is not available in https://www.npmjs.com/package/level-filesystem which is what React Native uses when shimming `fs` (because it cannot support sync APIs). I figured that this line of code is checking (1) whether `fs` is available and (2) whether `fs` is actually a filesystem API. It seems for purpose (2) that `readFile` is enough. Or is there a reason for `readFileSync`?

With these changes, an `fs` object missing `readFileSync` would still work as long as `loadSync` is avoided and `load` is used instead.
André Staltz authored on 3/18/2017, 5:48:42 PM
GitHub committed on 3/18/2017, 5:48:42 PM
Parent: 29308515cd352aab05e592677aee109b041ea7d3

Files changed

storage.jschanged
storage.jsView
@@ -20,9 +20,9 @@
2020 }
2121
2222 module.exports = function (generate) {
2323
24- if(!fs || !fs.readFileSync)
24 + if(!fs || !fs.readFile)
2525 return require('./local-storage')(generate)
2626
2727 var exports = {}
2828

Built with git-ssb-web