这是我的代码
var data = await sample(successFunctionName, failureFunctionName)
async function sample(successFunction,failureFunction){
var streamdata= fs.createReadStream("sample.txt")
var result = streamdata.on("error",failureFunction)
return result
}
var failureFunctionName=function(err){
\\\process the error and return value
return processedResult
}
我想从failureFunction返回的采样函数内的变量中获得处理后的结果。我是回调和错误的新手。任何帮助,将不胜感激。预先感谢