Which of the following will synchronously check if a file/directory exists?
Correct Answer: fs.existsSync()
Explanation:
Note: This Question is unanswered, help us to find answer for this one
Node.js Skill Assessment
Your Skill Level: Poor
Retake Quizzes to improve it
More Node.js MCQ Questions
Which of the following will open a file, then read its contents one line at a time?
Which of the following statements are true about the module.exports object in Node.js?
Which of the following statements are true about the child_process module in Node.js?
Which of the following methods can be used to read the contents of a directory?
What is the purpose of using URL hashes in Node.js?
The following code snippet when executed, should create a web server that serves the web page 'idx.html' from 'testing5' folder. However, the syntax of lines 3 and 4 are not correct. Select the correct replacements of lines 3 and 4 from the given answer options. 1. var exp = require ('express'); 2. var serveStatic = require ('serve-static'); 3. var app = express() 4. .use(serveStatic(dirname /testing5, {'index': ['idx.html']})) 5. .listen(3000);
What output will be generated on the execution of the following lines of code? var path = require('path'); console.log(path.join('test1'. 'ltest2'. 'test3'));
A module 'rimraf' is installed locally in a Node.js project. The following code snippet is supposed to delete a directory named testing2 from the same project however the code contains some errors identify which code lines contain an error. 1.var rim1 = require('rimraf'); 2.rimraf('./Testing2', function(error1)){ 3. if(error1) console.log('This is an error', error1); 4. else console.log('Directory deleted successfully'); 5.}
Carefully study the following code snippet and answer the question that follows. var exp = require('express'); var application1 = exp() .use(function (rq, rs){ console.log('Cookie Header:\n', rq.headers['cookie']); rs.cookie('\n name', 'Node.js'); rs.end('Hello Express World'); }).listen(3000); Which of the following code snippets should be added at the top of those files that use the mongodb module?