小编ank*_*185的帖子

如何使用 Nodejs 从 docx 文件中提取文本

我想从 docx 文件中提取文本,我尝试过使用 mammoth

var mammoth = require("mammoth");
mammoth.extractRawText({path: "./doc.docx"})
    .then(function(result){
        var text = result.value; // The raw text 

        //this prints all the data of docx file
        console.log(text);

        for (var i = 0; i < text.length; i++) {
            //this prints all the data char by char in separate lines
            console.log(text[i]);
        }
        var messages = result.messages;
    })
    .done();
Run Code Online (Sandbox Code Playgroud)

但这里的问题是,在这个 for 循环中,我想要逐行数据而不是逐字符数据,请在这里帮助我,或者您知道还有其他方法吗?

node.js mammoth

5
推荐指数
1
解决办法
1万
查看次数

使用 logstash 和 filebeat 时出现权限错误

我正在研究弹性堆栈,我已经运行了elasticsearch和logstash的服务器,并按照文档中所述进行进一步处理,此链接https://www.elastic.co/guide/en/logstash/current/advanced-pipeline.html

现在当我尝试执行这个命令时:

sudo ./filebeat -e -c filebeat.yml -d "publish"
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

Exiting: error loading config file: config file ("filebeat.yml") must be owned by the beat user (uid=0) or root
Run Code Online (Sandbox Code Playgroud)

我已更改该文件的权限,但无法解决此错误,请帮助

elasticsearch logstash filebeat

1
推荐指数
1
解决办法
5145
查看次数

标签 统计

elasticsearch ×1

filebeat ×1

logstash ×1

mammoth ×1

node.js ×1