Sha256: 14e0f4dfcc136a187ac9fe3d7a8c902c2ffddd8eda7ab25d50ce4bb908ecc8b2

Contents?: true

Size: 522 Bytes

Versions: 2

Compression:

Stored size: 522 Bytes

Contents

# echoToFile.coffee - Write in a given file all the parameters passed on the CLI
fs = require 'fs'
system = require 'system'

if system.args.length < 3
  console.log "Usage: echoToFile.coffee DESTINATION_FILE <arguments to echo...>"
  phantom.exit()
else
  content = ""
  f = null
  i = 2
  while i < system.args.length
    content += system.args[i] + (if i == system.args.length - 1 then "" else " ")
    ++i
  try
    f = fs.open(system.args[1], "w")
    f.writeLine content
  catch e
    console.log e
  phantom.exit()

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
phantomjs.rb-0.0.2 vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/echoToFile.coffee
phantomjs.rb-0.0.1 vendor/phantomjs-1.5.0-liunx-x86-dynamic/examples/echoToFile.coffee