NodeJS 消费者应用程序中 KCL 的正确 'require' 是多少?

What is the proper 'require' for KCL in a NodeJS consumer application?

我正在阅读 KCL(AWS 的 Kinesis 客户端库)的文档,如果我理解正确,我需要安装 KCL 本身 (Java),然后我的 NodeJS 消费者应用程序将能够访问它。首先,这是正确的吗?

如果是这样,我对 NodeJS 和 KCL 之间的联系感到困惑。我在 AWS 示例代码中看到以下行:

var kcl = require('../../..');

(在示例 here 中找到)

在NodeJS中,我习惯看到这样引用的JS文件,而不是目录。这似乎只是向上遍历文件系统 3 级并停止。这是什么参考?这是与KCL的联系吗?我是否只需要确保我的 KCL 安装位于将容纳此 require 语句的相对路径?

I need to install the KCL itself (Java) and then my NodeJS consumer application will be able to access it. First of all, is this correct?

是的,没错。
如果您为 nodejs 安装 KCL 并完全在 nodejs 中编写您的消费者应用程序,您仍然需要在系统上安装 Java,因为多语言守护进程。请参阅文档 here.

I'm confused by the linkage between NodeJS and KCL.

当给定 require 文件夹路径时,它将在其中查找 index.js。如果有,它会使用它,如果没有,它会失败。

在您的示例中,kcl 变量需要根目录中的 index.js

Do I just need to ensure that my KCL installation is located at a relative path that will accommodate this require statement?

不,在现实世界的应用程序中,您会 require 这个模块经常像这样 var kcl = require('aws-kcl'),这是 package.json

中给它的名称