MCPcopy
hub / github.com/SeleniumHQ/selenium / addDir

Method addDir

javascript/selenium-webdriver/io/zip.js:71–89  ·  view source on GitHub ↗

* Recursively adds a directory and all of its contents to this archive. * * @param {string} dirPath path to the directory to add. * @param {string=} zipPath path to the folder in the archive to add the * directory contents to. Defaults to the root folder. * @return {!Promise<?>} r

(dirPath, zipPath = '')

Source from the content-addressed store, hash-verified

69 * the operation is complete.
70 */
71 addDir(dirPath, zipPath = '') {
72 return io.walkDir(dirPath).then((entries) => {
73 let archive = this.z_
74 if (zipPath) {
75 archive = archive.folder(zipPath)
76 }
77
78 let files = []
79 entries.forEach((spec) => {
80 if (spec.dir) {
81 archive.folder(spec.path)
82 } else {
83 files.push(this.addFile(path.join(dirPath, spec.path), path.join(zipPath, spec.path)))
84 }
85 })
86
87 return Promise.all(files)
88 })
89 }
90
91 /**
92 * @param {string} path File path to test for within the archive.

Callers 3

buildProfileFunction · 0.95
installAddonMethod · 0.95
zip_test.jsFile · 0.80

Calls 3

addFileMethod · 0.95
joinMethod · 0.80
forEachMethod · 0.45

Tested by

no test coverage detected