Skip to content

Commit

Permalink
fix: use cp
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Oct 5, 2023
1 parent c78862f commit d28a20f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/tar.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d28a20f

Please sign in to comment.