-
Notifications
You must be signed in to change notification settings - Fork 120
Node.js Cheat Sheet
Lance Pollard edited this page Sep 26, 2012
·
2 revisions
exec = require('child_process').exec
exec 'ls -la', (error, stdout, stderr) ->
spawn = require('child_process').spawn
child = spawn 'node', ['server.js']
child.setEncoding('utf-8')
child.stdout.on 'data', (data) ->
child.stderr.on 'data', (data) ->
#!/usr/bin/env node
console.log('executing', __filename);
Here are the modules that will be used below:
fs = require('fs')
fs.readFile './bin/tower', 'utf-8', (error, string) ->
string = fs.readFileSync './bin/tower', 'utf-8'
fs.writeFile './tmp/README.md', '# Writing Files', (error) ->
fs.writeFileSync './tmp/README.md', '# Writing Files'