cdjs
cdjs copied to clipboard
Request for comments and feature requests
I would appreciate input on the following issues:
- all callbacks now receive "done" as the first argument. This was handy while writing the library, and is often more natural when writing callbacks for .then, but it feels unwieldy for other callbacks (.for, .ls, .read, etc.), because in the typical case that you aren't making any async calls in the callback, you won't be using done() in your functions at all. The question is: (a) should the order of the arguments be switched, and (b) if yes, should this change apply to all callbacks, including those for .then, i.e. should we sacrifice some comfort for consistency?
- how should .read / .write handle file types? The ability to pass e.g. an Image object to .write (which I intend to implement) seems straightforward, but what should happen on .read()? Should the callback for .read() get an instantiated and loaded Image object, or a Blob or what?
- does adding .try() and .catch() methods for error handling sound like a good idea? e.g. cd().try().rm('/nodir/nofile.txt').catch(function (done,err) { /* handle errors */ })
- and of course, general comments and feature requests are more than welcome.