import.js 462 B

1234567891011121314
  1. (function () {
  2. console.debug = console.log
  3. var socket = new (require('ws'))("ws://localhost:1622");
  4. var connection = require('q-connection')(socket);
  5. var api = require('riko-api/client')(function () { return connection })
  6. var data = require('fs').readFileSync(process.argv[2], 'utf8').trim();
  7. socket.onopen = function () {
  8. api('import', data).then(function (data) {
  9. console.log("imported" + data);
  10. process.exit()
  11. }).done()
  12. }
  13. })