admin管理员组文章数量:1410737
I'm trying to write a web crawler program using quickscrape, after I type
quickscrape \
--url \
--scraper journal-scrapers/scrapers/peerj.json \
--output peerj-384
--outformat bibjson
and hit the "Enter" in my terminal, the library will generate the result from the crawler and put them into a folder.
Now I want to write a javascript progarm so that is will call these terminal mands for me, but I am not sure how to interact with terminal in node.js.
I'm trying to write a web crawler program using quickscrape, after I type
quickscrape \
--url https://peerj./articles/384 \
--scraper journal-scrapers/scrapers/peerj.json \
--output peerj-384
--outformat bibjson
and hit the "Enter" in my terminal, the library will generate the result from the crawler and put them into a folder.
Now I want to write a javascript progarm so that is will call these terminal mands for me, but I am not sure how to interact with terminal in node.js.
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Nov 5, 2016 at 16:28 DeidaraDeidara 6772 gold badges14 silver badges28 bronze badges 1- Possible duplicate of Execute and get the output of a shell mand in node.js – Damjan Pavlica Commented Jul 17, 2018 at 12:58
1 Answer
Reset to default 7I think child_process is that you need. https://nodejs/api/child_process.html
let exec = require('child_process').exec;
exec('quickscrape --url https://peerj./articles/384 --scraper journal-scrapers/scrapers/peerj.json --output peerj-384 --outformat bibjson', (error, stdout, stderr) => {
//...
})
本文标签: javascriptrun terminal commands in node jsStack Overflow
版权声明:本文标题:javascript - run terminal commands in node js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744288106a2598980.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论