-
Notifications
You must be signed in to change notification settings - Fork 25
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
Showing
9 changed files
with
114 additions
and
37 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
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,33 @@ | ||
const AdmZip = require('adm-zip') | ||
|
||
var FileTransfer = class FileTransfer { | ||
|
||
//create the zip file containing the update | ||
//path is the path to the folder that represents slash on Dexter | ||
//https://github.com/cthackers/adm-zip/wiki/ADM-ZIP-Introduction | ||
static zip_folder(path_to_folder_to_zip) { | ||
let zip = new AdmZip(); | ||
zip.addLocalFolder(path_to_folder_to_zip) | ||
zip.writeZip(path_to_folder_to_zip + ".zip") | ||
out(path_to_folder_to_zip + ".zip created.") | ||
} | ||
|
||
//zip_file_path expected to end in .zip | ||
//unzips files into a new folder having the same file name as the zip_file_path | ||
//(excluding the .zip) | ||
//That new folder will be put under folder_for_folder_of_files. | ||
static unzip(zip_file_path, unzip_into_folder) { | ||
if (!unzip_into_folder) { | ||
unzip_into_folder = dde_apps_folder + "/firmware_unzipped" | ||
} | ||
//let file_name = this.path_to_file_name(zip_file_path) | ||
//file_name = file_name.substring(0, file_name.length - 4) //remove the .zip extension | ||
//folder_for_files = dde_apps_folder + "/" + file_name | ||
//} | ||
out("Unzipping: " + zip_file_path + " into: " + unzip_into_folder) | ||
let zip = new AdmZip(zip_file_path); | ||
zip.extractAllTo(unzip_into_folder, true) //true means overwrite if folder already exists | ||
out("Unzipped: " + zip_file_path + " into: " + unzip_into_folder) | ||
} | ||
} | ||
|
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