Sha256: 756d61bfca6c28fdfd769e97ec9e7cf02bac3bba43df59a30353d15406271b65

Contents?: true

Size: 497 Bytes

Versions: 2

Compression:

Stored size: 497 Bytes

Contents

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

if phantom.args.length < 2
  console.log "Usage: echoToFile.js DESTINATION_FILE <arguments to echo...>"
  phantom.exit()
else
  content = ""
  f = null
  i = 1
  while i < phantom.args.length
    content += phantom.args[i] + (if i == phantom.args.length - 1 then "" else " ")
    ++i
  try
    f = fs.open(phantom.args[0], "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.4.1_OSX/examples/echoToFile.coffee
phantomjs.rb-0.0.1 vendor/phantomjs-1.4.1_OSX/examples/echoToFile.coffee