Skip to content

[QUESTION] tar.x does not save directory structure. #261

Closed
@swateek

Description

@swateek

I have a tar file with the structure below:

    mysample.tar.gz
                HEADER.txt directory1 directory2 directory3

   directory1/
          resolv.conf resov.conf1 a1.txt
     
   directory2/
          stats.txt

Upon using the below line

await tar.x({cwd: extractionPath, file: fullFilePath});

I see that all files lose their directories, and come under one folder mentioned as "cwd" above. I really need to maintain the folder structure.

tar xf mysample.tar.gz -C extractionPath which is supposed to behave similarly as tar.x doesn't match. I am not sure what else I should try.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions