{"id":7584,"date":"2015-09-30T22:22:54","date_gmt":"2015-09-30T19:22:54","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=7584"},"modified":"2018-01-05T18:02:15","modified_gmt":"2018-01-05T16:02:15","slug":"node-js-command-line-programming","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/","title":{"rendered":"Node.js: Command line programming"},"content":{"rendered":"<p><em>This article is part of our Academy Course titled <a href=\"http:\/\/www.webcodegeeks.com\/javascript\/node-js\/building-web-apps-with-node-js\">Building web apps with Node.js<\/a>.<\/em><\/p>\n<p>In this course, you will get introduced to Node.js. You will learn how to install, configure and run the server and how to load various modules.<\/p>\n<p>Additionally, you will build a sample application from scratch and also get your hands dirty with Node.js command line programming.<br \/>\nCheck it out <a href=\"http:\/\/www.webcodegeeks.com\/javascript\/node-js\/building-web-apps-with-node-js\">here<\/a>!<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;7Yp6ijpjjxyeaN8A&#8217;]<\/p>\n<div class=\"toc\">\n<h4>Table Of Contents<\/h4>\n<dl>\n<dt><a href=\"#introduction\">1. Introduction<\/a><\/dt>\n<dt><a href=\"#ideas_make_utility_programs\">2. Utility Programs with Node.js<\/a><\/dt>\n<dt><a href=\"#commandline_program_ui\">3. Command Line and User Interaction<\/a><\/dt>\n<dt><a href=\"#file_handling_commandline\">4. File Handling<\/a><\/dt>\n<dt><a href=\"#publish_to_npm\">5. Publish the Program to NPM<\/a><\/dt>\n<dt><a href=\"#download\">6. Download the Source Code<\/a><\/dt>\n<\/dl>\n<\/div>\n<h2><a name=\"introduction\"><\/a>1. Introduction<\/h2>\n<p>Node.js is one of the most hyped technologies over the past few year. It is built with JavaScript and runs on the Chrome V8 engine Runtime.<\/p>\n<p>Node.js offers the following features while developing Applications:<\/p>\n<ol>\n<li>Develop once, run everywhere, from command line, server, or the browser.<\/li>\n<li>Event-driven programming.<\/li>\n<li>Non-blocking Input-Output Model.<\/li>\n<li>The main event loop from Node.js runs in Single thread.<\/li>\n<\/ol>\n<p>In this article, we will discuss about node.js command line programming. We will create a sample program which processes any file and interacts with users.<\/p>\n<h2><a name=\"ideas_make_utility_programs\"><\/a>2. Utility Programs with Node.js<\/h2>\n<p>Some useful modules are available with node.js, such as:<\/p>\n<ol>\n<li>Processing some data and preparing reports with node.js.<\/li>\n<li>Getting twitter data and storing them in the repository for further processing.<\/li>\n<\/ol>\n<p>So, first let&#8217;s build a simple program on to show you how to process command line arguments in node.js<\/p>\n<p>Our Program listing is nodecmd.js.<\/p>\n<p><em>nodecmd.js:<\/em><\/p>\n<pre class=\"brush:js\">\r\nprocess.argv.forEach(function (val, index, array) {\r\n\r\n  console.log(index + ': ' + val);\r\n\r\n});\r\n<\/pre>\n<p>Once we run this program with:<\/p>\n<pre class=\"brush:bash\">\r\nnode nodecmd.js one two three\r\n<\/pre>\n<p>we will have the output as follows:<\/p>\n<pre class=\"brush:bash\">\r\n0: node\r\n1: \/nodeapps\/nodecommandline\/nodecmd.js\r\n2: one\r\n3: two\r\n4: three\r\n<\/pre>\n<p>Here, the first printing line is node &#8211; the program. Second one is the program file name. The other three lines are printouts of the arguments.<\/p>\n<p><code>process<\/code> is a core module that comes with the node.js installation. More documentation on <code>process<\/code> can be found <a href=\" http:\/\/nodejs.org\/docs\/latest\/api\/process.html#process \" target=\"_blank\">here<\/a>.<\/p>\n<p>We will use a new module, named <code>commander.js<\/code>, for the command line processing in node.js> It has several useful options which we will look here.<\/p>\n<p>First, in order to install commander.js, we issue the following command in the node.js console:<\/p>\n<pre class=\"brush:bash\">\r\nnpm install commander\r\n<\/pre>\n<p>Below is the listing for the sample command line program:<\/p>\n<p><em>nodecommand.js:<\/em><\/p>\n<pre class=\"brush:js\">\r\nvar program = require('commander');\r\n\r\nprogram\r\n  .version('0.0.1')\r\n\r\nprogram\r\n  .command('show [name]')\r\n  .description('initialize command')\r\n  .action(function(name){\r\n        console.log('Yes '+ name +'...I have started...');\r\n});\r\n\r\nprogram\r\n  .command('bye')\r\n  .description('by command')\r\n  .action(function(){\r\n        console.log('Bye for now');\r\n\r\n});\r\n\r\nprogram\r\n  .command('*')\r\n  .action(function(env){\r\n    console.log('Please enter a Valid command');\r\n});\r\n\r\nprogram.parse(process.argv);\r\n<\/pre>\n<p>Now, some commands that we can run in the node.js console are:<\/p>\n<p>1. <\/p>\n<pre class=\"brush:bash\">node nodecommand.js -V<\/pre>\n<p>It will show the version number for the program, which we have defined with<\/p>\n<pre class=\"brush:js\">\r\nprogram\r\n  .version('0.0.1')\r\n<\/pre>\n<p>2. <\/p>\n<pre class=\"brush:bash\">node nodecommand.js -h<\/pre>\n<p>It will show a utility console with all the commands and usages like:<\/p>\n<ul>\n<li>Usage: nodecommand.js [options] [command]<\/li>\n<li>Commands:\n<ol>\n<li><em>show [name]<\/em>: initialize command<\/li>\n<li><em>bye<\/em>: by command<\/li>\n<li><em>*<\/em><\/li>\n<\/ol>\n<\/li>\n<li>Options:\n<ol>\n<li><em>-h, &#8211;help<\/em>: output usage information<\/li>\n<li><em>-V, &#8211;version<\/em>: output the version number<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p>3. <\/p>\n<pre class=\"brush:bash\">node nodecommand.js show Piyas<\/pre>\n<p>It will output the following in the console:<\/p>\n<pre class=\"brush:bash\">\r\nYes Piyas...I have started...\r\n<\/pre>\n<p>Here <code>Piyas<\/code> is passed as an argument in the nodecommand.js program.<\/p>\n<p>More on the use of commander can be found <a href=\"https:\/\/github.com\/visionmedia\/commander.js\" target=\"_blank\">here<\/a>.<\/p>\n<p>Now we can also run the program without prior initialization with the node command.<\/p>\n<p>We can save the above program content with the follwing line in the upper section of the code and save the file as nodesamplecommand:<\/p>\n<pre class=\"brush:js\">\r\n#!\/usr\/bin\/env node\r\n<\/pre>\n<p>Now if we run the statements:<\/p>\n<pre class=\"brush:bash\">\r\n.\/nodesamplecommand -h\r\n<\/pre>\n<p>or<\/p>\n<pre class=\"brush:js\">\r\n.\/nodesamplecommand show Piyas\r\n<\/pre>\n<p>they will give the same output as the previous program.<\/p>\n<p>The only thing we have to make sure is to have the program <code>node<\/code> in the system environment path.<\/p>\n<h2><a name=\"commandline_program_ui\"><\/a>3. Command Line and User Interaction<\/h2>\n<p>Let&#8217;s continue with a simple user interaction program with the node <code>process<\/code> as below:<\/p>\n<p><em>nodeuserinteraction:<\/em><\/p>\n<pre class=\"brush:js\">\r\n#!\/usr\/bin\/env node\r\n\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding('utf8');\r\nvar util = require('util');\r\n\r\nprocess.stdin.on('data', function (text) {\r\n\tconsole.log('received data:', util.inspect(text));\r\n\tif (text === 'exit\\\\n') {\r\n\t\tcomplete();\r\n\t}\r\n\telse\r\n\t{\r\n\t\tinvalidCommand();\r\n\t}\r\n});\r\n\r\nfunction complete() {\r\n\tconsole.log('There is nothing to do now.');\r\n\tprocess.exit();\r\n}\r\n\r\nfunction invalidCommand() {\r\n\tconsole.log('Please enter the valid command');\r\n}\r\n<\/pre>\n<p>In the execution of the program above, the <code>process<\/code> module will resume in the node.js console till some user input arrives. As long as the user enters some data except <code>exit<\/code>, the program will prompt as follows:<\/p>\n<pre class=\"brush:bash\">\r\nPlease enter the valid command\r\n<\/pre>\n<p>The program will stop when we issue the <code>exit<\/code> command.<\/p>\n<h2><a name=\"file_handling_commandline\"><\/a>4. File Handling in Node.js Command Line Program<\/h2>\n<p>Now we will work with a sample program, which will work with files. The user will enter a file as input in the console. The program will extract the keywords from the file and write the words in a different file.<\/p>\n<p>To get the keywords from the file, we will use module &#8216;keyword-extractor&#8217;:<\/p>\n<pre class=\"brush:bash\">\r\nnpm install keyword-extractor\r\n<\/pre>\n<p>This will install the keywords extractor library in the local repository.<\/p>\n<p>Now the program listing of <code>noderemovestopwords<\/code>:<\/p>\n<pre class=\"brush:js\">\r\n#!\/usr\/bin\/env node \/\/ Node environment path in Linux\r\n\r\nvar keyword_extractor = require(\"keyword-extractor\");\r\nfs = require('fs');\r\n\r\nvar program = require('commander');\r\n\r\nprogram\r\n  .version('0.0.1')\r\n\r\nprogram\r\n  .command('process [filename]')\r\n  .description('initialize command')\r\n  .action(function(filename){\r\n\tconsole.log(filename);\r\n        fs.readFile(fs.realpathSync(filename), 'utf8', function (err,data) {\r\n\t  if (err) {\r\n\t    return console.log(err);\r\n\t  }\r\n\t  \/\/Keyword Extraction\r\n\t  var extraction_result = keyword_extractor.extract(data,{\r\n\t\t                                                        language:\"english\",\r\n\t\t                                                        return_changed_case:true\r\n\t\t                                                   });\r\n\r\n\t  fs.writeFile(filename+'.out.txt', extraction_result, function (err) {\r\n\t\t  if (err) return console.log(err);\r\n\t\t  console.log('File writing done');\r\n\t\t});\r\n\t});\r\n});\r\n\r\nprogram.parse(process.argv);\r\n<\/pre>\n<p>To run the program, we need to write:<\/p>\n<pre class=\"brush:bash\">\r\n.\/noderemovestopwords process &lt;&gt;\r\n<\/pre>\n<p>which will output a file named <code>&lt;&lt;File Name&gt;&gt;.out.txt<\/code> in the output directory.<\/p>\n<p>Let&#8217;s now discuss the program:<\/p>\n<ul>\n<li>First we have taken the argument as <code>filename<\/code> in Command line.<\/li>\n<li>After this, we have read the file and processed the file contents using the keyword extraction library. As this keyword extraction process is a synchronous process, we have written the extracted content to a different file with the Node.js filesystem <code>writeFile<\/code> methods.<\/li>\n<li>And finally we have logged a message when the process ends within the <code>writeFile<\/code> callback function.<\/li>\n<\/ul>\n<p>So this is an example of file handling through node.js command line program.<\/p>\n<h2><a name=\"publish_to_npm\"><\/a>5. Publish the Program to NPM<\/h2>\n<p>NPM makes it really easy to share Node.js programs to the world. The Steps are:<\/p>\n<ol>\n<li>Create a configuration file for program.<\/li>\n<li>Execute the command publish.<\/li>\n<\/ol>\n<p>There should be a package.json file for the configuration:<\/p>\n<pre class=\"brush:js\">\r\n{\r\n  \"author\": \"Piyas De\",\r\n  \"name\": \"noderemovestopwords\",\r\n  \"url\" : \"http:\/\/www.phloxblog.in\",\r\n  \"description\": \"A sample CLi program created to extract the keywords from a given file and output the keywords to a different file\",\r\n  \"version\": \"0.0.4\",\r\n  \"repository\": {\r\n      \"type\": \"git\",\r\n      \"url\": \"https:\/\/github.com\/piyasde\/nodecommandline\"\r\n  },\r\n  \"main\": \".\/bin\/noderemovestopwords\",\r\n  \"keywords\": [\r\n      \"keyword\",\r\n      \"extractor\",\r\n      \"commandline\"\r\n  ],\r\n  \"bin\": {\r\n      \"noderemovestopwords\": \".\/bin\/noderemovestopwords\"\r\n  },\r\n  \"dependencies\": {\r\n      \"commander\": \"2.1.x\",\r\n      \"keyword-extractor\": \"0.0.7\"\r\n  },\r\n  \"engine\": \"node &gt;= 0.10.22\",\r\n  \"license\": \"BSD\"\r\n}\r\n<\/pre>\n<p>A Note for the Folder Structure:<\/p>\n<pre class=\"brush:bash\">\r\nnodecommandline\r\n  |--src\r\n      |--bin\r\n      |\t  |--noderemovestopwords\r\n      |--package.json\r\n      |--README.md\r\n<\/pre>\n<p>Now we need to execute:<\/p>\n<ul>\n<li><code>npm adduser<\/code>: to add the user name for whom the node.js package is uploaded.<\/li>\n<li><code>npm publish<\/code>: to publish the node.js package to the Repository.<\/li>\n<\/ul>\n<h2><a name=\"download\"><\/a>6. Download the Source Code<\/h2>\n<p>In this tutorial we discussed command line programming in Node.js. You may download the source code here: <a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/09\/Nodejs-Command_line.zip\">Nodejs-Command_line.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article is part of our Academy Course titled Building web apps with Node.js. In this course, you will get introduced to Node.js. You will learn how to install, configure and run the server and how to load various modules. Additionally, you will build a sample application from scratch and also get your hands dirty &hellip;<\/p>\n","protected":false},"author":18,"featured_media":924,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-7584","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-node-js"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Node.js: Command line programming - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"This article is part of our Academy Course titled Building web apps with Node.js. In this course, you will get introduced to Node.js. You will learn how\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Node.js: Command line programming - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"This article is part of our Academy Course titled Building web apps with Node.js. In this course, you will get introduced to Node.js. You will learn how\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:author\" content=\"http:\/\/www.facebook.com\/phlocblogger\" \/>\n<meta property=\"article:published_time\" content=\"2015-09-30T19:22:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-05T16:02:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Piyas De\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/phloxblog\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Piyas De\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/\"},\"author\":{\"name\":\"Piyas De\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/7aab6e040a06f0dfe0d60c27768aa424\"},\"headline\":\"Node.js: Command line programming\",\"datePublished\":\"2015-09-30T19:22:54+00:00\",\"dateModified\":\"2018-01-05T16:02:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/\"},\"wordCount\":885,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\",\"articleSection\":[\"Node.js\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/\",\"name\":\"Node.js: Command line programming - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\",\"datePublished\":\"2015-09-30T19:22:54+00:00\",\"dateModified\":\"2018-01-05T16:02:15+00:00\",\"description\":\"This article is part of our Academy Course titled Building web apps with Node.js. In this course, you will get introduced to Node.js. You will learn how\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Node.js\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/node-js\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Node.js: Command line programming\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/7aab6e040a06f0dfe0d60c27768aa424\",\"name\":\"Piyas De\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/eadd6728b7b5be23f0d6585da1a953926e49c6f2369703d6cb4f1147d4dd2203?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/eadd6728b7b5be23f0d6585da1a953926e49c6f2369703d6cb4f1147d4dd2203?s=96&d=mm&r=g\",\"caption\":\"Piyas De\"},\"description\":\"Piyas is Sun Microsystems certified Enterprise Architect with 10+ years of professional IT experience in various areas such as Architecture Definition, Define Enterprise Application, Client-server\/e-business solutions.Currently he is engaged in providing solutions for digital asset management in media companies.He is also founder and main author of \\\"Technical Blogs (Blog about small technical Know hows)\\\"\",\"sameAs\":[\"http:\/\/www.phloxblog.in\",\"http:\/\/www.facebook.com\/phlocblogger\",\"http:\/\/in.linkedin.com\/in\/piyasde\",\"https:\/\/x.com\/https:\/\/twitter.com\/phloxblog\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/piyas-de\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Node.js: Command line programming - Web Code Geeks - 2026","description":"This article is part of our Academy Course titled Building web apps with Node.js. In this course, you will get introduced to Node.js. You will learn how","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/","og_locale":"en_US","og_type":"article","og_title":"Node.js: Command line programming - Web Code Geeks - 2026","og_description":"This article is part of our Academy Course titled Building web apps with Node.js. In this course, you will get introduced to Node.js. You will learn how","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_author":"http:\/\/www.facebook.com\/phlocblogger","article_published_time":"2015-09-30T19:22:54+00:00","article_modified_time":"2018-01-05T16:02:15+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","type":"image\/jpeg"}],"author":"Piyas De","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/phloxblog","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Piyas De","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/"},"author":{"name":"Piyas De","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/7aab6e040a06f0dfe0d60c27768aa424"},"headline":"Node.js: Command line programming","datePublished":"2015-09-30T19:22:54+00:00","dateModified":"2018-01-05T16:02:15+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/"},"wordCount":885,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","articleSection":["Node.js"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/","name":"Node.js: Command line programming - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","datePublished":"2015-09-30T19:22:54+00:00","dateModified":"2018-01-05T16:02:15+00:00","description":"This article is part of our Academy Course titled Building web apps with Node.js. In this course, you will get introduced to Node.js. You will learn how","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-command-line-programming\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"Node.js","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/node-js\/"},{"@type":"ListItem","position":4,"name":"Node.js: Command line programming"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/7aab6e040a06f0dfe0d60c27768aa424","name":"Piyas De","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/eadd6728b7b5be23f0d6585da1a953926e49c6f2369703d6cb4f1147d4dd2203?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/eadd6728b7b5be23f0d6585da1a953926e49c6f2369703d6cb4f1147d4dd2203?s=96&d=mm&r=g","caption":"Piyas De"},"description":"Piyas is Sun Microsystems certified Enterprise Architect with 10+ years of professional IT experience in various areas such as Architecture Definition, Define Enterprise Application, Client-server\/e-business solutions.Currently he is engaged in providing solutions for digital asset management in media companies.He is also founder and main author of \"Technical Blogs (Blog about small technical Know hows)\"","sameAs":["http:\/\/www.phloxblog.in","http:\/\/www.facebook.com\/phlocblogger","http:\/\/in.linkedin.com\/in\/piyasde","https:\/\/x.com\/https:\/\/twitter.com\/phloxblog"],"url":"https:\/\/www.webcodegeeks.com\/author\/piyas-de\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/7584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=7584"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/7584\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/924"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=7584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=7584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=7584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}