简体   繁体   中英

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 -audit-level=critical I saw the document this is the way to check for audit with severity is critical. And I know there is a command to generate json directly in the terminal is 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. Plus I need to write a javascript that look through data of json file of audit. So is there a way to write a json file for npm audit ?

If you are on Linux you can redirect the output to a file like this:

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

More information

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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