Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / phantomjs / lib / phantom / examples / echoToFile.coffee
1 # echoToFile.coffee - Write in a given file all the parameters passed on the CLI
2 fs = require 'fs'
3 system = require 'system'
4
5 if system.args.length < 3
6   console.log "Usage: echoToFile.coffee DESTINATION_FILE <arguments to echo...>"
7   phantom.exit 1
8 else
9   content = ""
10   f = null
11   i = 2
12   while i < system.args.length
13     content += system.args[i] + (if i == system.args.length - 1 then "" else " ")
14     ++i
15   try
16     fs.write system.args[1], content, "w"
17   catch e
18     console.log e
19   phantom.exit()