-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathrun.js
More file actions
28 lines (24 loc) · 780 Bytes
/
run.js
File metadata and controls
28 lines (24 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env node
var url = require("url");
var program = require('commander');
var Importer = require('./lib/importer');
program
.version('0.0.1')
.option('-p, --path', 'Enter s3 bucket and prefix in format s3://bucket/prefix')
.parse(process.argv);
if(program.path) {
var path = url.parse(program.args[0]);
var importer = new Importer([]);
importer.getS3Records(path.host, path.pathname)
.then(function(records) {
importer.records = records;
console.log('Found', records.length, 'records.');
importer.run();
})
.catch(function(error) {
console.log(error);
});
} else {
console.log('Enter s3 bucket and prefix in format s3://bucket/prefix');
process.exit(1);
}