¡GoConqr estrena diseño! Cuéntanos qué te parece.

Módulo 9 de 14 · Texto

Important Core Modules

Tomas Katz

  • path
    • path.normalize
    • path.join
    • path.dirname, path. basename, path.extname
  • fs (file-system)
  • os (operating-system)
  • util (general utilities)
    • util.inherits
    • util.log
    • util.isArray
    • util.isDate
    • util.isError
  • require (function)
  • events
  • stream
    • stream.Readable
    • stream.Writebale
    • stream.Duplex
    • stream.Transform
    • NOTE! all the above inherit from Stream which you should not use directly.
    • NOTE! Stream inherits from EventEmitter

 

 

Requiring a module steps made by node

Then the follow is the logic followed by Node.js for a require('something') statement:

• If something is a core module, return it.
• If something is a relative path (starts with ‘./’ , ‘../’) return that file OR folder.
• If not, look for node_modules/filename or node_modules/foldername each level up until you
find a file OR folder that matches something.


When matching a file OR folder:, follow these steps:
• If it matched a file name, return it.
• If it matched a folder name and it has package.json with main, return that file.
• If it matched a folder name and it has an index file, return it.
 

Instrucciones

Para avanzar en el curso, envía un intento de este test. Puedes enviarlo después de la última pregunta.

Ir al módulo elegido

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?