require()实际返回什么,文件或函数

例如,我有profile.js

var EventEmitter = require("events").EventEmitter; var https = require("https"); var http = require("http"); var util = require("util"); function Profile(username) { // function code here } util.inherits( Profile, EventEmitter ); module.exports = Profile; 

在我的app.js中,我有

 var Profile = require("./profile.js"); var studentProfile = new Profile("chalkers"); /** * When the JSON body is fully recieved the * the "end" event is triggered and the full body * is given to the handler or callback **/ studentProfile.on("end", console.dir); /** * If a parsing, network or HTTP error occurs an * error object is passed in to the handler or callback **/ studentProfile.on("error", console.error); 

所以variables是profile.js本身或函数Profile(用户名)? 如果profile.js具有不同的function,比如我在profile.js中有函数SetProfile(username),应该如何导出这两个函数并在app.js中使用它们?

require(...)函数返回“required”模块中的module.exports值,以及Profile函数的情况。


另外,我不知道什么是“ 返回文件 ”或“ profile是profile.js本身 ”的意思。