Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Extracting .rar file in NIFI

avatar
New Contributor

 I am getting .zip files as well as .rar files from my source location. While i am able to unzip the .zip files using unpack content processor , i am not able to extract the .rar files. I even tried compress component processor but seems that too doesn't support .rar files.  How should i extract the .rar files ?  install winrar in root folder and then call it using execute stream processor ? 

3 REPLIES 3

avatar
Expert Contributor

UnpackContent processor do not support .rar file:

http://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.11.4/org.apache...

 

Hence, yes you can use an ExecuteStreamCommand processor to invoke WinRAR command-line tool.

avatar
Explorer

I realize this topic is a bit old, but I have this same problem to solve. I am struggling with setting the unrar in the ExecuteStreamCommand process, then having the decompressed files returned in the output on the stream for additional processing. I am getting broken pipe errors and unrar cmd ended in nonzero errors. How exactly do I set this up so that it works just like Nifi's native UnpackContent process? Thank you.

 

avatar
Super Mentor

@Phil_I_AM 
Always best tot start a new question rather than commenting on an old post.  Will get you better traction that way from the community.

The reason NiFi does not have native processor that can handle rar files is because there does not appear to be java native libraries available to do this. https://issues.apache.org/jira/browse/NIFI-8391

 

You may consider filtering and writing your rar files to a flow specific directory on disk and then use the ExecuteStreamCommand processor to unpack that rar in that directory.  You could have a new flow that uses the listFile (configured to ignore files with rar extension) and FetchFile processor to monitor that directory for new files and consume them for further processing.

If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.

Thank you,

Matt