From d28a20f92343244720500d8a8ccccf0d6182972a Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Thu, 5 Oct 2023 16:03:11 -0600 Subject: [PATCH] fix: use cp --- src/tar.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/tar.ts b/src/tar.ts index 68a1ee30..0d4ee9b2 100644 --- a/src/tar.ts +++ b/src/tar.ts @@ -1,6 +1,6 @@ import makeDebug from 'debug' import {existsSync} from 'node:fs' -import {copyFile, rename, rm} from 'node:fs/promises' +import {cp, rename, rm} from 'node:fs/promises' import {join} from 'node:path' import {touch} from './util.js' @@ -69,10 +69,7 @@ async function extract(stream: NodeJS.ReadableStream, basename: string, output: if (existsSync(output)) { try { const tmp = getTmp() - // TODO: is it safe to use copyFile instead? - // const {move} = await import('fs-extra') - // await move(output, tmp) - await copyFile(output, tmp) + await cp(output, tmp) await rm(tmp, {force: true, recursive: true}).catch(debug) } catch (error: any) { debug(error)