June 2025
Intermediate to advanced
837 pages
24h 50m
English
Like the recent versions of Node.js, Deno uses the ECMAScript module system, that is, the import and export keywords. For a better description of the module system, let’s return to our example of copying a file and recapitulate. We implemented the two functions getInputAndOutputFiles and fileExists. These are ideal candidates for outsourcing to a separate module. So, you create a new file called util.js, copy the two functions into the file, and export it. Listing 28.18 shows the source code of the util.js file.
export function getInputAndOutputFiles() { const input = Deno.args .find((arg) => arg.startsWith('--input=')) .substr(8); const output = Deno.args .find((arg) => arg.startsWith('--output=')) .substr(9); console ...
Read now
Unlock full access