Skip to content

Commit fa08b2e

Browse files
committed
add noExtract flag to downloadAndExtractFile()
1 parent 3a2f4ac commit fa08b2e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/cubejs-backend-shared/src/http-utils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ export async function streamWithProgress(
6666
type DownloadAndExtractFile = {
6767
showProgress: boolean;
6868
cwd: string;
69+
noExtract?: boolean;
6970
};
7071

71-
export async function downloadAndExtractFile(url: string, { cwd }: DownloadAndExtractFile) {
72+
export async function downloadAndExtractFile(url: string, { cwd, noExtract }: DownloadAndExtractFile) {
7273
const request = new Request(url, {
7374
headers: new Headers({
7475
'Content-Type': 'application/octet-stream',
@@ -99,7 +100,11 @@ export async function downloadAndExtractFile(url: string, { cwd }: DownloadAndEx
99100
});
100101
});
101102

102-
await decompress(savedFilePath, cwd);
103+
if (noExtract) {
104+
fs.copyFileSync(savedFilePath, cwd);
105+
} else {
106+
await decompress(savedFilePath, cwd);
107+
}
103108

104109
try {
105110
fs.unlinkSync(savedFilePath);

0 commit comments

Comments
 (0)