dailylog 7-23-20
https://marketplace.visualstudio.com/items?itemName=satokaz.vscode-markdown-header-coloring
const fs = require("fs");
fs.readdir(".", (err, filenames) => {
if (err) {
console.log(err);
}
console.log(filenames);
});
const fs = require("fs");
fs.readdir(process.cwd(), (err, filenames) => {
if (err) {
console.log(err);
}
console.log(filenames);
});
ADD EXECUTABLE TO PACKAGE.JSON FILE
"bin": {
"name-of-executable": "index.js"
}
To actually be able to link and run a project we have to:
npm init -y
- create index.js with a console log or something
- Create package.json with ‘bin’ section
- Change
index.js
file permissions –>chmod +x index.js
- Add a comment to
index.js
to allow it to be treated like an executable –>#!/usr/bin/env node
- Link the project –>
npm link
- (Issues linking the project required me to give super user permissions to node libraries ) SO
sudo chown -R $USER /usr/local/lib/node_modules
Is it a File or a Folder?
lstat
JAVASCRIPT TRICKS!!
const allStats = Array(filenames.length).fill(null)
myArray.every(takes iterator function)
allStats.every((stats) => {
return stats;
});
NOTES: proceess.argv[2]