@@ -343,7 +343,7 @@ export class K8 {
343
343
* @param {string } containerName
344
344
* @param {string } destPath - path inside the container
345
345
* @param {number } [timeout] - timeout in ms
346
- * @returns {Promise<{owner: string, size: number, modifiedAt: string, name: string, directory: boolean, group: string}> }
346
+ * @returns {Promise<{owner: string, size: number, modifiedAt: string, name: string, directory: boolean, group: string}[] > }
347
347
* array of directory entries, custom object
348
348
*/
349
349
async listDir ( podName , containerName , destPath , timeout = 5000 ) {
@@ -567,13 +567,11 @@ export class K8 {
567
567
const destPath = path . join ( destDir , srcFile )
568
568
569
569
// download the tar file to a temp location
570
- // const tmpFile = `${this._tempFileFor(srcFile)}.tar`
571
570
const tmpFile = this . _tempFileFor ( srcFile )
572
571
573
572
const self = this
574
573
return new Promise ( ( resolve , reject ) => {
575
574
const execInstance = new k8s . Exec ( this . kubeConfig )
576
- // const command = ['tar', '-cf', '-', '-C', srcDir, srcFile]
577
575
const command = [ 'cat' , `${ srcDir } /${ srcFile } ` ]
578
576
const outputFileStream = fs . createWriteStream ( tmpFile )
579
577
const outputPassthroughStream = new stream . PassThrough ( { highWaterMark : 10 * 1024 * 1024 } )
@@ -637,13 +635,8 @@ export class K8 {
637
635
638
636
try {
639
637
fs . copyFileSync ( tmpFile , destPath )
640
- // extract the downloaded file
641
- // tar.x({
642
- // file: tmpFile,
643
- // cwd: destDir
644
- // }).then(() => {
645
- // self._deleteTempFile(tmpFile)
646
- this . logger . debug ( `tmpFile=${ tmpFile } ` )
638
+
639
+ self . _deleteTempFile ( tmpFile )
647
640
648
641
const stat = fs . statSync ( destPath )
649
642
let rejection
@@ -665,11 +658,6 @@ export class K8 {
665
658
} else {
666
659
return resolve ( true )
667
660
}
668
- // }).catch((err) => {
669
- // const errorMessage = `failed copying from ${podName}:${srcDir}/${srcFile} to ${destPath} to download file completely: ${destPath}${additionalErrorMessageDetail}`
670
- // this.logger.error(errorMessage, err)
671
- // return reject(new FullstackTestingError(errorMessage, err))
672
- // })
673
661
} catch ( e ) {
674
662
const errorMessage = `failed to complete copying from ${ podName } :${ srcDir } /${ srcFile } to ${ destPath } to extract file: ${ destPath } `
675
663
this . logger . error ( errorMessage , e )
0 commit comments