In this case when initializing the file handling system in node.js the online documentation uses:
const fs = require('fs'); const { URL } = require('url'); const fileUrl = new URL('file:///tmp/hello'); fs.readFileSync(fileUrl);
I am not familiar with the braces around the URL as in { URL }. What do they do here? On the previous line the fs is not surrounded with braces.
https://nodejs.org/dist/latest-v8.x/docs/api/fs.html#fs_threadpool_usage
https://stackoverflow.com/questions/66913263/javascript-syntax-question-const-url-requireurl April 02, 2021 at 09:00AM
没有评论:
发表评论