Sha256: 981fcf8778ad995d4c6e522d3c6af90b7f1e42340f67380807e2def02c3b9a93

Contents?: true

Size: 591 Bytes

Versions: 17

Compression:

Stored size: 591 Bytes

Contents

// echoToFile.js - Write in a given file all the parameters passed on the CLI
var fs = require('fs'),
    system = require('system');

if (system.args.length < 3) {
    console.log("Usage: echoToFile.js DESTINATION_FILE <arguments to echo...>");
    phantom.exit(1);
} else {
    var content = '',
        f = null,
        i;
    for ( i= 2; i < system.args.length; ++i ) {
        content += system.args[i] + (i === system.args.length-1 ? '' : ' ');
    }
    
    try {
        fs.write(system.args[1], content, 'w');
    } catch(e) {
        console.log(e);
    }

    phantom.exit();
}

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
hooch-0.4.1 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
hooch-0.4.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
hooch-0.3.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
hooch-0.2.1 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
hooch-0.2.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
hooch-0.1.0 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
hooch-0.0.8 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
hooch-0.0.7 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
hooch-0.0.6 jasmine/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
entangled-0.0.16 spec/dummy/public/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
entangled-0.0.15 spec/dummy/public/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
entangled-0.0.14 spec/dummy/public/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
entangled-0.0.13 spec/dummy/public/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
entangled-0.0.12 spec/dummy/public/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
entangled-0.0.11 spec/dummy/public/node_modules/phantomjs/lib/phantom/examples/echoToFile.js
entangled-0.0.10 spec/dummy/public/node_modules/phantomjs/lib/phantom/examples/echoToFile.js