From 140cd7e4db030401bba660a1ffe934e0c3f1e529 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 27 Mar 2020 13:57:26 +0100 Subject: [PATCH] cli/commands/build-cache: remove unused archive function --- .../cli/src/commands/build-cache/archive.ts | 35 ------------------- 1 file changed, 35 deletions(-) diff --git a/packages/cli/src/commands/build-cache/archive.ts b/packages/cli/src/commands/build-cache/archive.ts index be74504f1f..b4a736240d 100644 --- a/packages/cli/src/commands/build-cache/archive.ts +++ b/packages/cli/src/commands/build-cache/archive.ts @@ -18,41 +18,6 @@ import fs from 'fs-extra'; import tar from 'tar'; import { dirname } from 'path'; -export async function readFileFromArchive( - archivePath: string, - filePath: string, -): Promise { - const reader = fs.createReadStream(archivePath); - const parser = new ((tar.Parse as unknown) as { new (): tar.ParseStream })(); - - const fileEntry = await new Promise((resolve, reject) => { - parser.on('entry', entry => { - if (entry.path === `./${filePath}`) { - resolve(entry); - reader.close(); - } else { - entry.resume(); - } - }); - parser.on('end', () => { - reject(new Error('cache archive did not contain build info')); - }); - parser.on('error', error => reject(error)); - reader.on('error', error => reject(error)); - - reader.pipe(parser); - }); - - const data = await new Promise((resolve, reject) => { - const chunks = new Array(); - fileEntry.on('data', chunk => chunks.push(chunk)); - fileEntry.on('end', () => resolve(Buffer.concat(chunks))); - fileEntry.on('error', error => reject(error)); - }); - - return data; -} - // packages all files in inputDir into an archive at archivePath, deleting any existing archive export async function createArchive( archivePath: string,