Node JS module classification

Source: Internet
Author: User

Core module require (' FS ');

Core modules are compiled into binary code

File module require ('.. /fs.js ');

There is no point when loading the module. //.../, the search path of the module is loaded. If ‘/home/ry/projects/foo.js‘ the file in is called require (' bar.js '), node will search in the following location:

/home/ry/projects/node_modules/bar.js/home/ry/node_modules/bar.js/home/node_modules/bar.js/node_modules/ Bar.js

Folder module require ('.. /fs ');

If there is no Package.json file under this directory, node will attempt to load the Index.js or Index.node file from this directory. For example, if there is no Package.json file above, then require ('./some-library ') will attempt to load the following file:
./some-library/fs.js ./some-library/fs.node

Node JS module classification

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.