diff --git a/examples/echoToFile.coffee b/examples/echoToFile.coffee index 425ec56f..e886f937 100644 --- a/examples/echoToFile.coffee +++ b/examples/echoToFile.coffee @@ -13,8 +13,7 @@ else content += system.args[i] + (if i == system.args.length - 1 then "" else " ") ++i try - f = fs.open(system.args[1], "w") - f.writeLine content + fs.write system.args[1], content, "w" catch e console.log e phantom.exit() diff --git a/examples/echoToFile.js b/examples/echoToFile.js index 3f92d08e..924a703e 100644 --- a/examples/echoToFile.js +++ b/examples/echoToFile.js @@ -14,10 +14,8 @@ if (system.args.length < 3) { } try { - f = fs.open(system.args[1], "w"); - f.writeLine(content); - f.close(); - } catch (e) { + fs.write(system.args[1], content, 'w'); + } catch(e) { console.log(e); }