Closed jcubic closed 5 years ago
BrowserFS and Node both use Buffers, but the browser polyfill for Node buffers is quite large so I have started avoiding using Buffers in isomorphic JavaScript code.
Can I suggest you use readFile(filepath, 'utf8')
instead of readFile(filepath).toString()
? That should work with all 3 systems.
With browserFS you can call toString and get the value as string. With Lighting-FS it don't work like this. In node you can also use toString not sure what object readFile give in node.
check https://stackoverflow.com/questions/8936984/uint8array-to-string-in-javascript