Skip to content

Commit

Permalink
Trying to statically include unzip
Browse files Browse the repository at this point in the history
  • Loading branch information
safwank committed Aug 26, 2012
1 parent 10273e6 commit f3671a3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion import/batchimport.js
Expand Up @@ -119,7 +119,7 @@ function unzipCSVFilesIn(zipFilePath, callback) {
var csvFilesPath = path.join(FILE_DROP, zipFileName);

var spawn = require('child_process').spawn;
var unzip = spawn('unzip', [zipFilePath, '-d', csvFilesPath]);
var unzip = spawn('tools/unzip', [zipFilePath, '-d', csvFilesPath]);

unzip.stdout.on('data', function(data) {});
unzip.stderr.on('data', function(data) {});
Expand All @@ -131,6 +131,27 @@ function unzipCSVFilesIn(zipFilePath, callback) {

callback(null, csvFilesPath);
});

/*
fs.mkdirSync(csvFilesPath);
var zipFileContent = fs.readFileSync(zipFilePath, 'utf8');
var zip = new require('node-zip')(zipFileContent, {base64: false, checkCRC32: true});
zip.files.forEach(function(file) {
sys.puts(file.name);
var uncompressed = path.join(csvFilesPath, file.name);
var buffer = file.content;
var fd = fs.openSync(uncompressed, 'w');
fs.writeSync(fd, buffer, 0, buffer.length, null);
fs.closeSync(fd);
});
sys.puts('Finished unzipping ' + zipFilePath);
if (thisSocket) thisSocket.emit('unzipFileProgress', {
progress: 100
});
callback(null, csvFilesPath);*/
}

function importCSVFilesIn(csvFilesPath, callback) {
Expand Down
Binary file added tools/unzip
Binary file not shown.

0 comments on commit f3671a3

Please sign in to comment.