datproject-discussions icon indicating copy to clipboard operation
datproject-discussions copied to clipboard

Avoid using synchronous file access in modules (eg. fs.readFileSync)

Open aschrijver opened this issue 7 years ago • 2 comments

I tried porting hypercore to React Native and try it on Android, but got stuck by the use of synchronous file access in various dat modules, like fs.readFileSync in hypercore-protocol (messages.js, line 5)

(already discussed about this with @mafintosh and @karissa )

A full description of my issue can be found at stackoverflow:

General advice:

If future mobile support is in any way interesting to Dat, then use of incompatible Node objects methods should be avoided as much as possible!

aschrijver avatar Jul 21 '17 06:07 aschrijver

Can you use a transform like https://github.com/substack/brfs in the build process?

bcomnes avatar Jul 21 '17 16:07 bcomnes

Yes I intend to try, but right now I don't know how to integrate it without browserify.

And even then I wonder if it is smart to handle synchronous fs on android / ios

aschrijver avatar Jul 21 '17 16:07 aschrijver