I'm writing an Electron application, and in this application I need to interact with some of the Node.js APIs - read files, get directory entries, listen to events.
Of course, I can write ClojureScript same way I would write JavaScript, but I want to know what is ClojureScripts take on callback-style APIs, streams, EventEmitters and how do I write wrappers around node.js APIs in a way that does not to look alien in ClojureScript.
To be specific:
- How do write an API that wraps callback-style node.js API. (say,
fs.readdir
) - How do I interact with EventEmitter-like APIs?
- (Probably close to p.2) How do I work with node.js streams API?