Skip to content

Instantly share code, notes, and snippets.

@lamarmarshall
Created October 26, 2017 20:12
Show Gist options
  • Save lamarmarshall/925656c2056659af8e2618f88ab6ed79 to your computer and use it in GitHub Desktop.
Save lamarmarshall/925656c2056659af8e2618f88ab6ed79 to your computer and use it in GitHub Desktop.
nodejs file append get logged in user info
console.log("starting app")
const fs = require('fs')
const os = require('os')
var user = os.userInfo();
fs.appendFile("test.txt", 'i hate everything, my name is '+user["username"]+"\n", (err) => {
if(err){
console.log("could not write")
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment