Where can I get an array of all native node modules?












1















I am looking for a way to get a list of all available node modules. It would be interesting to get this dynamically, because different versions or future versions may add or deprecate modules.










share|improve this question























  • cd /usr/share/doc/nodejs/api | find ./ -name "*.md"

    – Vadim Hulevich
    Jan 2 at 9:34
















1















I am looking for a way to get a list of all available node modules. It would be interesting to get this dynamically, because different versions or future versions may add or deprecate modules.










share|improve this question























  • cd /usr/share/doc/nodejs/api | find ./ -name "*.md"

    – Vadim Hulevich
    Jan 2 at 9:34














1












1








1








I am looking for a way to get a list of all available node modules. It would be interesting to get this dynamically, because different versions or future versions may add or deprecate modules.










share|improve this question














I am looking for a way to get a list of all available node modules. It would be interesting to get this dynamically, because different versions or future versions may add or deprecate modules.







javascript node.js






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 2 at 8:52









ThomasReggiThomasReggi

18.5k44148273




18.5k44148273













  • cd /usr/share/doc/nodejs/api | find ./ -name "*.md"

    – Vadim Hulevich
    Jan 2 at 9:34



















  • cd /usr/share/doc/nodejs/api | find ./ -name "*.md"

    – Vadim Hulevich
    Jan 2 at 9:34

















cd /usr/share/doc/nodejs/api | find ./ -name "*.md"

– Vadim Hulevich
Jan 2 at 9:34





cd /usr/share/doc/nodejs/api | find ./ -name "*.md"

– Vadim Hulevich
Jan 2 at 9:34












4 Answers
4






active

oldest

votes


















3














If you are using Node version > 8.11.3, the recommended way to achieve that is to use the builtinModules property of the module object, as follows:



const builtins = require('module').builtinModules;


Further details: https://nodejs.org/api/modules.html#modules_module_builtinmodules






share|improve this answer































    3














    You can use this code to get the list of all globally installed modules:



    function exec(callback) {
    require('child_process').exec('npm ls -g --depth=0 --json', function(err, data, stderr) {
    if (err) return cb(err)
    callback(data);
    });
    }

    function get_modules(callback) {
    var res = ;
    exec(function(d) {
    d = JSON.parse(d);
    var m = d.dependencies;
    for(key in m) res.push(key);
    callback(res);
    });
    }

    get_modules(console.log);


    If you want built-in modules , use



    console.log(require("module").builtinModules)


    Refer this doc.






    share|improve this answer

































      0














      You can get the list of native modules like this:



      const repl = require('repl') 
      console.log(repl._builtinLibs)


      This way you get the native modules available in your specific version of Nodejs.






      share|improve this answer































        -1














        const m = [
        "assert",
        "buffer",
        "child_process",
        "cluster",
        "console",
        "constants",
        "crypto",
        "dgram",
        "dns",
        "domain",
        "events",
        "fs",
        "http",
        "https",
        "module",
        "net",
        "os",
        "path",
        "process",
        "punycode",
        "querystring",
        "readline",
        "repl",
        "stream",
        "string_decoder",
        "sys",
        "timers",
        "tls",
        "tty",
        "url",
        "util",
        "vm",
        "zlib"
        ];





        share|improve this answer



















        • 1





          Is this a joke?

          – ruakh
          Jan 2 at 9:27











        • @ruakh no I think it's useful to have an array of all of them same as this list here stackoverflow.com/questions/14168703/crypto-algorithm-list

          – ThomasReggi
          Jan 2 at 10:02











        • Maybe it would be better to add this list in the question or in an answer, the same way as in the link you refer to.

          – TGrif
          Jan 2 at 17:58











        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54003490%2fwhere-can-i-get-an-array-of-all-native-node-modules%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        3














        If you are using Node version > 8.11.3, the recommended way to achieve that is to use the builtinModules property of the module object, as follows:



        const builtins = require('module').builtinModules;


        Further details: https://nodejs.org/api/modules.html#modules_module_builtinmodules






        share|improve this answer




























          3














          If you are using Node version > 8.11.3, the recommended way to achieve that is to use the builtinModules property of the module object, as follows:



          const builtins = require('module').builtinModules;


          Further details: https://nodejs.org/api/modules.html#modules_module_builtinmodules






          share|improve this answer


























            3












            3








            3







            If you are using Node version > 8.11.3, the recommended way to achieve that is to use the builtinModules property of the module object, as follows:



            const builtins = require('module').builtinModules;


            Further details: https://nodejs.org/api/modules.html#modules_module_builtinmodules






            share|improve this answer













            If you are using Node version > 8.11.3, the recommended way to achieve that is to use the builtinModules property of the module object, as follows:



            const builtins = require('module').builtinModules;


            Further details: https://nodejs.org/api/modules.html#modules_module_builtinmodules







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 2 at 9:42









            Itay MamanItay Maman

            23.1k868104




            23.1k868104

























                3














                You can use this code to get the list of all globally installed modules:



                function exec(callback) {
                require('child_process').exec('npm ls -g --depth=0 --json', function(err, data, stderr) {
                if (err) return cb(err)
                callback(data);
                });
                }

                function get_modules(callback) {
                var res = ;
                exec(function(d) {
                d = JSON.parse(d);
                var m = d.dependencies;
                for(key in m) res.push(key);
                callback(res);
                });
                }

                get_modules(console.log);


                If you want built-in modules , use



                console.log(require("module").builtinModules)


                Refer this doc.






                share|improve this answer






























                  3














                  You can use this code to get the list of all globally installed modules:



                  function exec(callback) {
                  require('child_process').exec('npm ls -g --depth=0 --json', function(err, data, stderr) {
                  if (err) return cb(err)
                  callback(data);
                  });
                  }

                  function get_modules(callback) {
                  var res = ;
                  exec(function(d) {
                  d = JSON.parse(d);
                  var m = d.dependencies;
                  for(key in m) res.push(key);
                  callback(res);
                  });
                  }

                  get_modules(console.log);


                  If you want built-in modules , use



                  console.log(require("module").builtinModules)


                  Refer this doc.






                  share|improve this answer




























                    3












                    3








                    3







                    You can use this code to get the list of all globally installed modules:



                    function exec(callback) {
                    require('child_process').exec('npm ls -g --depth=0 --json', function(err, data, stderr) {
                    if (err) return cb(err)
                    callback(data);
                    });
                    }

                    function get_modules(callback) {
                    var res = ;
                    exec(function(d) {
                    d = JSON.parse(d);
                    var m = d.dependencies;
                    for(key in m) res.push(key);
                    callback(res);
                    });
                    }

                    get_modules(console.log);


                    If you want built-in modules , use



                    console.log(require("module").builtinModules)


                    Refer this doc.






                    share|improve this answer















                    You can use this code to get the list of all globally installed modules:



                    function exec(callback) {
                    require('child_process').exec('npm ls -g --depth=0 --json', function(err, data, stderr) {
                    if (err) return cb(err)
                    callback(data);
                    });
                    }

                    function get_modules(callback) {
                    var res = ;
                    exec(function(d) {
                    d = JSON.parse(d);
                    var m = d.dependencies;
                    for(key in m) res.push(key);
                    callback(res);
                    });
                    }

                    get_modules(console.log);


                    If you want built-in modules , use



                    console.log(require("module").builtinModules)


                    Refer this doc.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jan 2 at 10:01

























                    answered Jan 2 at 9:22









                    vinoth hvinoth h

                    371110




                    371110























                        0














                        You can get the list of native modules like this:



                        const repl = require('repl') 
                        console.log(repl._builtinLibs)


                        This way you get the native modules available in your specific version of Nodejs.






                        share|improve this answer




























                          0














                          You can get the list of native modules like this:



                          const repl = require('repl') 
                          console.log(repl._builtinLibs)


                          This way you get the native modules available in your specific version of Nodejs.






                          share|improve this answer


























                            0












                            0








                            0







                            You can get the list of native modules like this:



                            const repl = require('repl') 
                            console.log(repl._builtinLibs)


                            This way you get the native modules available in your specific version of Nodejs.






                            share|improve this answer













                            You can get the list of native modules like this:



                            const repl = require('repl') 
                            console.log(repl._builtinLibs)


                            This way you get the native modules available in your specific version of Nodejs.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Jan 2 at 9:37









                            TGrifTGrif

                            3,36681936




                            3,36681936























                                -1














                                const m = [
                                "assert",
                                "buffer",
                                "child_process",
                                "cluster",
                                "console",
                                "constants",
                                "crypto",
                                "dgram",
                                "dns",
                                "domain",
                                "events",
                                "fs",
                                "http",
                                "https",
                                "module",
                                "net",
                                "os",
                                "path",
                                "process",
                                "punycode",
                                "querystring",
                                "readline",
                                "repl",
                                "stream",
                                "string_decoder",
                                "sys",
                                "timers",
                                "tls",
                                "tty",
                                "url",
                                "util",
                                "vm",
                                "zlib"
                                ];





                                share|improve this answer



















                                • 1





                                  Is this a joke?

                                  – ruakh
                                  Jan 2 at 9:27











                                • @ruakh no I think it's useful to have an array of all of them same as this list here stackoverflow.com/questions/14168703/crypto-algorithm-list

                                  – ThomasReggi
                                  Jan 2 at 10:02











                                • Maybe it would be better to add this list in the question or in an answer, the same way as in the link you refer to.

                                  – TGrif
                                  Jan 2 at 17:58
















                                -1














                                const m = [
                                "assert",
                                "buffer",
                                "child_process",
                                "cluster",
                                "console",
                                "constants",
                                "crypto",
                                "dgram",
                                "dns",
                                "domain",
                                "events",
                                "fs",
                                "http",
                                "https",
                                "module",
                                "net",
                                "os",
                                "path",
                                "process",
                                "punycode",
                                "querystring",
                                "readline",
                                "repl",
                                "stream",
                                "string_decoder",
                                "sys",
                                "timers",
                                "tls",
                                "tty",
                                "url",
                                "util",
                                "vm",
                                "zlib"
                                ];





                                share|improve this answer



















                                • 1





                                  Is this a joke?

                                  – ruakh
                                  Jan 2 at 9:27











                                • @ruakh no I think it's useful to have an array of all of them same as this list here stackoverflow.com/questions/14168703/crypto-algorithm-list

                                  – ThomasReggi
                                  Jan 2 at 10:02











                                • Maybe it would be better to add this list in the question or in an answer, the same way as in the link you refer to.

                                  – TGrif
                                  Jan 2 at 17:58














                                -1












                                -1








                                -1







                                const m = [
                                "assert",
                                "buffer",
                                "child_process",
                                "cluster",
                                "console",
                                "constants",
                                "crypto",
                                "dgram",
                                "dns",
                                "domain",
                                "events",
                                "fs",
                                "http",
                                "https",
                                "module",
                                "net",
                                "os",
                                "path",
                                "process",
                                "punycode",
                                "querystring",
                                "readline",
                                "repl",
                                "stream",
                                "string_decoder",
                                "sys",
                                "timers",
                                "tls",
                                "tty",
                                "url",
                                "util",
                                "vm",
                                "zlib"
                                ];





                                share|improve this answer













                                const m = [
                                "assert",
                                "buffer",
                                "child_process",
                                "cluster",
                                "console",
                                "constants",
                                "crypto",
                                "dgram",
                                "dns",
                                "domain",
                                "events",
                                "fs",
                                "http",
                                "https",
                                "module",
                                "net",
                                "os",
                                "path",
                                "process",
                                "punycode",
                                "querystring",
                                "readline",
                                "repl",
                                "stream",
                                "string_decoder",
                                "sys",
                                "timers",
                                "tls",
                                "tty",
                                "url",
                                "util",
                                "vm",
                                "zlib"
                                ];






                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Jan 2 at 8:53









                                ThomasReggiThomasReggi

                                18.5k44148273




                                18.5k44148273








                                • 1





                                  Is this a joke?

                                  – ruakh
                                  Jan 2 at 9:27











                                • @ruakh no I think it's useful to have an array of all of them same as this list here stackoverflow.com/questions/14168703/crypto-algorithm-list

                                  – ThomasReggi
                                  Jan 2 at 10:02











                                • Maybe it would be better to add this list in the question or in an answer, the same way as in the link you refer to.

                                  – TGrif
                                  Jan 2 at 17:58














                                • 1





                                  Is this a joke?

                                  – ruakh
                                  Jan 2 at 9:27











                                • @ruakh no I think it's useful to have an array of all of them same as this list here stackoverflow.com/questions/14168703/crypto-algorithm-list

                                  – ThomasReggi
                                  Jan 2 at 10:02











                                • Maybe it would be better to add this list in the question or in an answer, the same way as in the link you refer to.

                                  – TGrif
                                  Jan 2 at 17:58








                                1




                                1





                                Is this a joke?

                                – ruakh
                                Jan 2 at 9:27





                                Is this a joke?

                                – ruakh
                                Jan 2 at 9:27













                                @ruakh no I think it's useful to have an array of all of them same as this list here stackoverflow.com/questions/14168703/crypto-algorithm-list

                                – ThomasReggi
                                Jan 2 at 10:02





                                @ruakh no I think it's useful to have an array of all of them same as this list here stackoverflow.com/questions/14168703/crypto-algorithm-list

                                – ThomasReggi
                                Jan 2 at 10:02













                                Maybe it would be better to add this list in the question or in an answer, the same way as in the link you refer to.

                                – TGrif
                                Jan 2 at 17:58





                                Maybe it would be better to add this list in the question or in an answer, the same way as in the link you refer to.

                                – TGrif
                                Jan 2 at 17:58


















                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54003490%2fwhere-can-i-get-an-array-of-all-native-node-modules%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                MongoDB - Not Authorized To Execute Command

                                How to fix TextFormField cause rebuild widget in Flutter

                                Npm cannot find a required file even through it is in the searched directory