Original question is what difference is there if i call a function without callback or with callback
i am using ssh2 library to list directory on remote sftp server for that there is a function "readdir"
if i call readdir as below it works all perfect
readdir(path, (err, list)=>{
console.log(list); //list have all data as it should be
}
but if i call function like this (to use it normally in async function)
list= readdir(path);
above code return error from ssh2 dependency ssh2-streams
error is
cb is not a function
cb(undefined, stream);