Hi! I'm Arjun Rawal, and I wrote a version of my resume that you can install onto your own computer via the command line interface!
Step 1. Initialize the npm package to create a package.json file.
Step 2. Create three files (index.js, readme.md, and info.json) in the new directory.
Step 3. Add the following code to the first line of index.js :
#! /usr/bin/env node
This allows us to run the code globally as well as from the command line.
Step 4. This part is key. It allows you to access the file system (fs
), which is a pre-defined pacakge within the npm node. fs
has many pre-defined functions that come with it. We will use the fs.readFile()
function to "read" the info.json that contains the resume information.
const fs = require('fs')
fs.readFile(__dirname + '/info.json', 'utf8', function(err, data) {
if (err) {
console.log(err)
} else {
console.log(data)
return data
}
})
Step 5. Then add this following to your package.json file:
"your-command-here": "./index.js"
},
Step 6. Write the resume in the info.json file!