Module

external class Module(source)

Constructors

Link copied to clipboard
constructor(id: String, parent: Module = definedExternally)

Properties

Link copied to clipboard
var children: <Error class: unknown class><Module>

The module objects required for the first time by this one.

Link copied to clipboard
var exports: Any?

The module.exports object is created by the Module system. Sometimes this is not acceptable; many want their module to be an instance of some class. To do this, assign the desired export object to module.exports.

Link copied to clipboard

The fully resolved filename of the module.

Link copied to clipboard
var id: String

The identifier for the module. Typically this is the fully resolved filename.

Link copied to clipboard

true if the module is running during the Node.js preload phase.

Link copied to clipboard

Whether or not the module is done loading, or is in the process of loading.

Link copied to clipboard

The module that first required this one, or null if the current module is the entry point of the current process, or undefined if the module was loaded by something that is not a CommonJS module (e.g. REPL or import).

Link copied to clipboard

The directory name of the module. This is usually the same as the path.dirname() of the module.id.

Link copied to clipboard
var paths: <Error class: unknown class><String>

The search paths for the module.

Functions

Link copied to clipboard
fun require(id: String): Any?

The module.require() method provides a way to load a module as if require() was called from the original module.