dat-ecosystem-archive / datproject-discussions

a repo for discussions and other non-code organizing stuff [ DEPRECATED - More info on active projects and modules at https://dat-ecosystem.org/ ]
65 stars 6 forks source link

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

Open aschrijver opened 6 years ago

aschrijver commented 6 years ago

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!

bcomnes commented 6 years ago

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

aschrijver commented 6 years ago

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