Closed ghost closed 5 years ago
memdown
(or the app that it is used in) should be be bundled for browsers using browserify
, webpack
or similar. Those bundlers will replace usage of Buffer
with https://github.com/feross/buffer, so that code is universal (works the same in node and browsers).
Feel free to reopen or comment here if you have additional questions. Level/browserify-starter
might be helpful. It bundles level-js
rather than memdown
, but the process is the same.
This could be just a 'me' problem, but I ran into a very difficult to debug issue due to my misunderstanding of how memdown stores worked in the browser. I figured since it used Buffers for Keys and Values, that I needed a browser Buffer implementation. What ended up happening was I'd put buffer values created with this https://github.com/feross/buffer, then when I would read them, it would presumably return another buffer format, the contents of which were completely different. Running it in node and switching to regular node buffers worked fine.
Can I get a clarification of how buffers should be consumed in the browser?