Skip to main content
Solved

Encoding multiple zipfile


arthur_bazin
Contributor
Forum|alt.badge.img+14

Hello,

I have a trouble with zipfiles.

I made a script that take multiple files and put them into a PostgreSQL database (in a binary column).

My script works really great : I'm using a datafile reader to get files and the PostgreSQL writter put them into my DB without any problems.

Where it doesn't work : when I try to import zip files, FME try to unzip them.

 

I don't want them to be unzipped, I want them to be imported as zip files directly into the DB.

 

Have you any solution ?

 

Thank you for your answer.

Best regards.

Arthur Bazin

Best answer by debbiatsafe

Hi @savoierider

I would recommend taking a look at the AttributeFileReader transformer for zip files instead of using the Data File reader.

I tested with a sample zip file and the AttributeFileReader created an attribute containing a value that starts the hexadecimal value 504B0304. This matches with the file signature for .zip files listed on this page: https://en.wikipedia.org/wiki/List_of_file_signatures

View original
Did this help you find an answer to your question?

3 replies

arthur_bazin
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • March 16, 2020

No one ever had this trouble or a solution ?

 


debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • Best Answer
  • March 16, 2020

Hi @savoierider

I would recommend taking a look at the AttributeFileReader transformer for zip files instead of using the Data File reader.

I tested with a sample zip file and the AttributeFileReader created an attribute containing a value that starts the hexadecimal value 504B0304. This matches with the file signature for .zip files listed on this page: https://en.wikipedia.org/wiki/List_of_file_signatures


arthur_bazin
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • March 20, 2020

Hi @debbiatsafe,

Thanks for your answer but it was only part of the solution. But my question was not complete :-)

After a lot of research, I find how to do what I want :

First, get a Directory and File Pathnames Reader with the option "Single Merged Feature Type".

 

Then using the AttributeFileReader.

Ok, it look really simple and easy but I don't know why, sometimes (on other projects) the Directory and File Pathnames Reader open zip files and lists all files that are in. I think it comes from parameters of the Reader but I can not find exactly witch parameter. But nevermind, it works and that's the goal...

Thank's


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings