Skip to content

Commit

Permalink
Merge pull request #4 from joseEnrique/master
Browse files Browse the repository at this point in the history
added DIRECTORY var into export and import
  • Loading branch information
masumsoft authored Jan 10, 2018
2 parents 657a11f + d28caa6 commit 56209d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions export.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if (!KEYSPACE) {

var USER = process.env.USER;
var PASSWORD = process.env.PASSWORD;

var DIRECTORY = process.env.DIRECTORY || "./data";
var authProvider;

if (USER && PASSWORD) {
Expand All @@ -28,7 +28,7 @@ function processTableExport(table) {
console.log('==================================================');
console.log('Reading table: ' + table);
return new Promise(function(resolve, reject) {
var jsonfile = fs.createWriteStream('data/' + table + '.json');
var jsonfile = fs.createWriteStream(DIRECTORY +"/" + table + '.json');
jsonfile.on('error', function (err) {
reject(err);
});
Expand Down
3 changes: 2 additions & 1 deletion import.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ if (!KEYSPACE) {

var USER = process.env.USER;
var PASSWORD = process.env.PASSWORD;
var DIRECTORY = process.env.DIRECTORY || "./data";

var authProvider;

Expand Down Expand Up @@ -82,7 +83,7 @@ function processTableImport(table) {
}

console.log('Creating read stream from: ' + table + '.json');
var jsonfile = fs.createReadStream('data/' + table + '.json', {encoding: 'utf8'});
var jsonfile = fs.createReadStream(DIRECTORY + '/' + table + '.json', {encoding: 'utf8'});
var readStream = jsonfile.pipe(jsonStream.parse('*'));
var queryPromises = [];
var processed = 0;
Expand Down

0 comments on commit 56209d5

Please sign in to comment.