This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-07-09
Channels
Can I write to a file with joyride? I assume i can use nbb fs package via NPM deps? (haven’t tried it yet) Or use vscode extension fs api?
Ok thanks, maybe another generic question:
Also I tried this fn, but not sure how to read promise it returns.
(vscode/workspace.fs.readDirectory ".")
(p/let [dir (vscode/workspace.fs.readDirectory ".")]
dir)
=> #<Promise[~]>
Not sure how to get the value, or if I’m invoking the vscode fn correctly.
if you print dir
it will have the value, but the result of the entire expression will always be a promise, you can't escape this
Ok thanks! I’m still not getting value, but maybe I have vscode fn wrong (construct uri better?)
(p/let
[dir (vscode/workspace.fs.readDirectory "file:///Users/")]
(print dir))
=> #<Promise[~]>
not the return value of the expression that is printed, but the print as a side effect
I got stuck on that too, a while back. I think that would be good to add to the joyride docs; I came from jvm clojure, and this was one of the stumbling blocks.
Will do, thanks