如何从Node.js包中调用函数导入



我正在使用sendSafelyAPI来提取数据,我很难调用这个特定的函数。


var sendSafely = new SendSafely("https://host.sendsafely.com/", "apikey", "apisecret");
sendSafely.verifyCredentials(function(email)  {
console.log("Connected to SendSafely as user "  +  email);
});

如何调用此函数(verifyCredentials(?

如果你看一下Github存储库中节点库的QuickStart示例,就会发现一些错误事件处理逻辑,它应该会为你提供错误的详细信息。

试试这个:

const SendSafely = require('@sendsafely/sendsafely');

var sendSafely = new SendSafely("https://www.sendsafely.com/", "apikey", "apisecret");
sendSafely.on('sendsafely.error', function(error, errorMsg) {
console.log(error + ": " + errorMsg);
});
sendSafely.verifyCredentials(function(email)  {
console.log("Connected to SendSafely as user "  +  email);
});

相关内容

  • 没有找到相关文章

最新更新