1- import { TarArchive } from "archiver" ;
1+ import archiver from "archiver" ;
22import AsyncLock from "async-lock" ;
33import Dockerode , { ContainerInspectInfo } from "dockerode" ;
44import { promises as fs } from "fs" ;
@@ -192,7 +192,7 @@ export class StartedGenericContainer implements StartedTestContainer {
192192 public async copyFilesToContainer ( filesToCopy : FileToCopy [ ] ) : Promise < void > {
193193 log . debug ( `Copying files to container...` , { containerId : this . container . id } ) ;
194194 const client = await getContainerRuntimeClient ( ) ;
195- const tar = new TarArchive ( ) ;
195+ const tar = archiver ( "tar" ) ;
196196 const filesToCopyWithStats = await Promise . all (
197197 filesToCopy . map ( async ( fileToCopy ) => ( {
198198 ...fileToCopy ,
@@ -208,7 +208,7 @@ export class StartedGenericContainer implements StartedTestContainer {
208208 public async copyDirectoriesToContainer ( directoriesToCopy : DirectoryToCopy [ ] ) : Promise < void > {
209209 log . debug ( `Copying directories to container...` , { containerId : this . container . id } ) ;
210210 const client = await getContainerRuntimeClient ( ) ;
211- const tar = new TarArchive ( ) ;
211+ const tar = archiver ( "tar" ) ;
212212 directoriesToCopy . forEach ( ( { source, target } ) => tar . directory ( source , target ) ) ;
213213 tar . finalize ( ) ;
214214 await client . container . putArchive ( this . container , tar , "/" ) ;
@@ -218,7 +218,7 @@ export class StartedGenericContainer implements StartedTestContainer {
218218 public async copyContentToContainer ( contentsToCopy : ContentToCopy [ ] ) : Promise < void > {
219219 log . debug ( `Copying content to container...` , { containerId : this . container . id } ) ;
220220 const client = await getContainerRuntimeClient ( ) ;
221- const tar = new TarArchive ( ) ;
221+ const tar = archiver ( "tar" ) ;
222222 contentsToCopy . forEach ( ( { content, target, mode } ) => tar . append ( content , { name : target , mode : mode } ) ) ;
223223 tar . finalize ( ) ;
224224 await client . container . putArchive ( this . container , tar , "/" ) ;
0 commit comments