Watches jupyter kernel directories for you.
var KernelWatch = require('jupyter-kernel-watch')
var watcher = KernelWatch(['/path/to/kernels', '/another/path/to/.jupyter/kernels'])
watcher.on('data', function (kernelSpecs) {
// kernelSpecs is a list of the contents of the kernel.json as a JSON object
// e.g. [
// {
// "filepath": "/path/to/kernels/python/kernel.json",
// "data": { "display_name": "Python 2", "language": "python", "argv": [ etc...]}
// }
// ]
//
})
watcher.close()
Returns a watcher
dirs
: the directories to watch
Closes the watcher -- stops watching the filesystem.
There should be more, but right now it just emits one event -- that's when the kernel spec (kernel.json
) has changed.
watcher.on('data', function (kernelSpecs) {
// list of kernelspecs
})