Skip to content

Commit

Permalink
feat: allow to set the cwd in copyToPod for use in tar
Browse files Browse the repository at this point in the history
  • Loading branch information
SayakMukhopadhyay committed Feb 15, 2023
1 parent 6aa7539 commit 998e631
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,23 @@ export class Cp {
* @param {string} containerName - The name of the container in the pod to exec the command inside.
* @param {string} srcPath - The source path in local
* @param {string} tgtPath - The target path in the pod
* @param {string} cwd - The directory that is used as the parent when uploading
*/
public async cpToPod(
namespace: string,
podName: string,
containerName: string,
srcPath: string,
tgtPath: string,
cwd?: string,
): Promise<void> {
const tmpFile = tmp.fileSync();
const tmpFileName = tmpFile.name;
const command = ['tar', 'xf', '-', '-C', tgtPath];
await tar.c(
{
file: tmpFile.name,
cwd,
},
[srcPath],
);
Expand Down

0 comments on commit 998e631

Please sign in to comment.