-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joshua Marinacci
committed
Jun 23, 2014
1 parent
fd8c3b5
commit fdcf712
Showing
4 changed files
with
58 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
var fs = require('fs'); | ||
var http = require('http'); | ||
var AdmZip = require('adm-zip'); | ||
|
||
|
||
var src = 'http://www.airspayce.com/mikem/arduino/AccelStepper/AccelStepper-1.41.zip'; | ||
|
||
var outfile = './'+src.substring(src.lastIndexOf('/')+1); | ||
var outdir = 'blah'; | ||
console.log('downloading ', src); | ||
console.log("output file = ",outfile); | ||
console.log("outdir = ",outdir); | ||
|
||
var req = http.get(src); | ||
req.on('response', function(res) { | ||
res.pipe(fs.createWriteStream(outfile)).on('close',function(){ | ||
console.log('its over'); | ||
var zip = new AdmZip(outfile); | ||
var zipEntries = zip.getEntries(); | ||
var rootpath = zipEntries[0].entryName; | ||
rootpath = rootpath.substring(0,rootpath.indexOf('/')); | ||
/* | ||
zipEntries.forEach(function(zipEntry) { | ||
console.log(zipEntry.toString()); // outputs zip entries information | ||
}); | ||
*/ | ||
zip.extractAllTo(outdir,true); | ||
console.log("root path = ",rootpath); | ||
console.log('done extracting from ',outfile); | ||
|
||
//rename to be lower case | ||
fs.renameSync(outdir+'/'+rootpath, outdir+'/'+rootpath.toLowerCase()); | ||
|
||
}); | ||
}); |