Autosave: 2024-04-28 11:20:04
This commit is contained in:
parent
82904585af
commit
b060061481
2 changed files with 8 additions and 4 deletions
BIN
.zk/notebook.db
BIN
.zk/notebook.db
Binary file not shown.
|
@ -9,7 +9,7 @@ created: Friday, April 26, 2024
|
||||||
|
|
||||||
If we want to use NodeJS as a scripting language without going to the trouble of
|
If we want to use NodeJS as a scripting language without going to the trouble of
|
||||||
setting up an NPM-based development environment, we can use the following
|
setting up an NPM-based development environment, we can use the following
|
||||||
architecture
|
architecture.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
@ -26,7 +26,11 @@ if (require.main === module) {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
This obviously requires NodeJS to be in your path and executable privileges.
|
Basically we have a function that contains the main actions of the script. This
|
||||||
|
is then invoked within `main` in the manner of a Bash or
|
||||||
|

|
||||||
|
|
||||||
The key part is the module check at the bottom which makes the script file
|
This obviously requires the Node binary to be in your path and the script must
|
||||||
invocable.
|
be run with executable privileges.
|
||||||
|
|
||||||
|
The module check at the bottom which makes the script file invocable.
|
||||||
|
|
Loading…
Add table
Reference in a new issue