Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serializing stream #11

Closed
dmitry opened this issue Jan 2, 2012 · 2 comments
Closed

Serializing stream #11

dmitry opened this issue Jan 2, 2012 · 2 comments

Comments

@dmitry
Copy link

dmitry commented Jan 2, 2012

How to serialize a stream? For example I want to serialize everything into StringIO object. ZipOutputStream have second parameter in initialize method for that kind of things. We can do something like:

def serialize(output, confirm_valid=false)
  # ...
  Zip::ZipOutputStream.send(output.is_a?(String) ? :open : :write_buffer) # and so on..

So it will be possible to use Package.new.serialize(StringIO.new(""))

More or less duplicate of #3

@randym
Copy link
Owner

randym commented Jan 4, 2012

Hi Dmitry

Just got back from our long New Year holiday in Japan, so please accept my apologies for the delay in getting back to you.
Thanks for the tip on using :write_buffer! Right now I am deep inside MS-OFF-CRYPTO and MS-CBF in an attempt to achieve password protection and encryption for xlsx files. Is there any chance you could send in a pull request that uses an IO buffer?

randym pushed a commit that referenced this issue Feb 7, 2012
@randym
Copy link
Owner

randym commented Feb 7, 2012

Hey Dmitry -

I've added in to_stream on the package will will return a rewound StringIO object for the package.
This will be released with 1.0.17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants