简体   繁体   English

将 NPM 审计生成为 Json 文件

[英]Generate NPM Audit into a Json file

I haven't see any post about this question.我没有看到任何关于这个问题的帖子。 What I'm planning to do is to generate npm audit into json file, but I will only generate the list of packages with high or critical severity.我打算做的是将npm audit生成到 json 文件中,但我只会生成具有高或严重严重性的包列表。

npm audit -audit-level=critical I saw the document this is the way to check for audit with severity is critical. npm audit -audit-level=critical我看到了文档,这是检查审计严重性的方法是关键。 And I know there is a command to generate json directly in the terminal is npm audit -json .而且我知道有一个命令可以直接在终端中生成 json 是npm audit -json I combined both:我结合了两者:

npm audit -audit-level=critical -json

This works great, it show json in the terminal, but with except that I cannot scroll all the way up to read all of them.这很好用,它在终端中显示 json,但除此之外我无法一直向上滚动以阅读所有内容。 Plus I need to write a javascript that look through data of json file of audit.另外,我需要编写一个 javascript 来查看审计的 json 文件的数据。 So is there a way to write a json file for npm audit ?那么有没有办法为npm audit编写一个 json 文件?

If you are on Linux you can redirect the output to a file like this:如果你在 Linux 上,你可以将输出重定向到这样的文件:

npm audit -audit-level=critical -json > audit.json  

More information 更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM