Modules are libraries for Node.js. See the below excerpt from the API:
Node.js has a simple module loading system. In Node.js, files and modules
are in one-to-one correspondence.
Examples of modules:
- Circle.js
- Rectangle.js
- Square.js
A package is one or more modules (libraries) grouped (or packaged) together. These are commonly used by other packages or a project of your own. Node.js uses a package manager, where you can find and install thousands of packages.
Example of a package:
Shapes <- Package name
- Circle.js <-
- Rectangle.js <- Modules that belong to the Shapes package
- Square.js <-
Essentially, you could install the package, Shapes
, and have access to the Circle, Rectangle, and Square modules.