cljs-node-io
cljs-node-io copied to clipboard
Incorrect opts structure has surprising results
Dear kind maintainer, This may simply need none of your attention and can probably be closed, but just in case input validation strikes your fancy.
I some how decided that the following code was correct.
(io/aslurp "afile.txt" {:encoding ""})
It looked like all was well, my files were being read and pushed over the wire just as i expected. But I kept having errors reconstructing the files. After finally resorting to hexdumping the file I noticed lots of hex 0xEF 0xBF 0xBD
in my output file. after running around in circles for quite some time i realized the only place this could possibly be happening is actually reading in the file. So I dug back into your docs and found that i was indeed using your library incorrectly. the correct answer was
(io/aslurp "afile.txt" :encoding "")
Now, of course, this was user error. But just a little sprinkling of input validation could save a soul such as mine.
Anyways thank you for putting this library together, despite my inability to read it has made my life quite a bit simpler. :heart:
Yes, overloaded opts is awful but unfortunately its an old clojure idiom. I will look into validating them. thanks!