span8
span4
span8
span4
Is it possible to take a binary string in memory and use it in a transformer to tell it to treat it as a zip file?I know I can use a FeatureWriter (format set to data file) to write the binary string to disk then use a FeatureReader to read it back into memory.I was trying to skip the step of writing it to disk.Any help would be great!
Hi@justincornell,if the binary data containing zipped archives is saved as a feature attribute,you can manipulate it as a zip file directly with a Python,PythonCaller.e.g.
# PythonCaller Script Example# Assuming the attribute "_response_body" stores# a binary data containing zipped archives.import fme,fmeobjectsimport io,zipfileclass ZipManipulator(object): def __init__(self): pass def input(self,feature): bin = feature.getAttribute('_response_body') buff = io.BytesIO(bin) with zipfile.ZipFile(buff,'r') as z: # # Do something with the ZipFile object.# pass
Hi@justincornellIs performance your main concern?I think it would be easiest to make a RAM disk and write your zip file to that.
© 2019 亚搏在线Safe Software Inc |Legal