login about faq

I want to see if there is any future plans to add an API to extract only a specific file/ certain extension from the tar without untarring the whole bundle.

asked Sep 25 '12 at 12:18

chilkat's gravatar image

chilkat ♦♦
11.8k316358421


If using programming language that supports callbacks, one possibility is to use the NextTarFile callback to set the "skip" flag for all files except the ones you need to extract. For example, in C++, you have this:

class CkTarProgress : public CkObject 
{
    public:
    CkTarProgress() { }
    virtual ~CkTarProgress() { }

// pathInTar 
virtual void ProgressInfo(const char *name, const char *value) { }

// Called periodically to check to see if the method call should be aborted.
virtual void AbortCheck(bool *abort) { }

// Called just before appending to TAR when writing a .tar, and just before
// extracting during untar.
virtual void NextTarFile(const char *fileName, 
    __int64 fileSize,
    bool bIsDirectory, 
    bool *skip) { }

};

Your app would define a class that derives from CkTarProgress, and then implement the NextTarFile method, overriding the empty implementation in the base class. Your callback method would examine the fileName and set the skip bool equal to true if the file should not be extracted.

The equivalent callback is available w/ the ActiveX, Objective-C, and .NET implementations.

link

answered Sep 25 '12 at 12:22

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×17

Asked: Sep 25 '12 at 12:18

Seen: 1,276 times

Last updated: Sep 25 '12 at 12:22

powered by OSQA