Linux Today: Linux News On Internet Time.

More on LinuxToday

Open Source Web Development: Understanding and Developing Node Modules

Aug 13, 2011, 03:04 (0 Talkback[s])
(Other stories by David Herron)


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

[ Thanks to Naheed for this link. ]

"Generally speaking the module name is a path name, but with the file extension removed. That is, when we write require('./simple'), Node knows to add .js to the file name and load in simple.js.

"Modules whose file names end in .js are of course expected to be written in JavaScript. Node also supports binary code native libraries as Node modules. In this case the file name extension to use is .node. It's outside our scope to discuss implementation of a native code Node module, but this gives you enough knowledge to recognize them when you come across them.

"Some Node modules are not files in the file system, but are baked into the Node executable. These are the Core modules, the ones documented on nodejs.org. Their original existence is as files in the Node source tree but the build process compiles them into the binary Node executable.

"There are three types of module identifiers: relative, absolute, and top-level."

Complete Story

Related Stories: