ZIPArchive usage + FileSystem memory

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ZIPArchive usage + FileSystem memory

Juraj Kubelka
Hi,

I can successfully use ZipArchive like the following

-=-=-
zip := ZipArchive new.
{ 'file1.txt'. 'file2.txt'. 'file3.txt' } do: [ :eachFile |
        | member |
        member := zip addString: eachFile, ' contents' as: eachFile.
        member desiredCompressionMethod: ZipArchive compressionDeflated ].
file := FileLocator temp / 'archive.zip'.
zip writeTo: file writeStream.
file.
-=-=-

What I should do to make it work while using FileSystem memory?

-=-=-
zip := ZipArchive new.
{ 'file1.txt'. 'file2.txt'. 'file3.txt' } do: [ :eachFile |
        | member |
        member := zip addString: eachFile, ' contents' as: eachFile.
        member desiredCompressionMethod: ZipArchive compressionDeflated ].
fileSystem := FileSystem memory.
file := fileSystem root / 'archive.zip'.
file writeStreamDo: [ :stream |
        zip writeTo: stream ].
-=-=-

There is "Improper store into indexable object” as it tries to store a number in ByteString.
Thanks!
Juraj


Reply | Threaded
Open this post in threaded view
|

Re: ZIPArchive usage + FileSystem memory

Guillermo Polito
Hi Juraj,

The file streams opened in a memory file system are not polymorphic with the ones in a disk file system :(.

Can you open an issue and assing it to me? I'll work soon on making all of them work and yield binary streams.

On Wed, Nov 29, 2017 at 9:06 PM, Juraj Kubelka <[hidden email]> wrote:
Hi,

I can successfully use ZipArchive like the following

-=-=-
zip := ZipArchive new.
{ 'file1.txt'. 'file2.txt'. 'file3.txt' } do: [ :eachFile |
        | member |
        member := zip addString: eachFile, ' contents' as: eachFile.
        member desiredCompressionMethod: ZipArchive compressionDeflated ].
file := FileLocator temp / 'archive.zip'.
zip writeTo: file writeStream.
file.
-=-=-

What I should do to make it work while using FileSystem memory?

-=-=-
zip := ZipArchive new.
{ 'file1.txt'. 'file2.txt'. 'file3.txt' } do: [ :eachFile |
        | member |
        member := zip addString: eachFile, ' contents' as: eachFile.
        member desiredCompressionMethod: ZipArchive compressionDeflated ].
fileSystem := FileSystem memory.
file := fileSystem root / 'archive.zip'.
file writeStreamDo: [ :stream |
        zip writeTo: stream ].
-=-=-

There is "Improper store into indexable object” as it tries to store a number in ByteString.
Thanks!
Juraj





--

   

Guille Polito

Research Engineer

Centre de Recherche en Informatique, Signal et Automatique de Lille

CRIStAL - UMR 9189

French National Center for Scientific Research - http://www.cnrs.fr


Web: http://guillep.github.io

Phone: +33 06 52 70 66 13

Reply | Threaded
Open this post in threaded view
|

Re: ZIPArchive usage + FileSystem memory

CyrilFerlicot


On Thu, Nov 30, 2017 at 10:10 AM, Guillermo Polito <[hidden email]> wrote:
Hi Juraj,

The file streams opened in a memory file system are not polymorphic with the ones in a disk file system :(.

Can you open an issue and assing it to me? I'll work soon on making all of them work and yield binary streams.



Hi,


If you open another one, you can close this one. Or maybe just rename this one with the stream class you intend to use. 
 
--

   

Guille Polito

Research Engineer

Centre de Recherche en Informatique, Signal et Automatique de Lille

CRIStAL - UMR 9189

French National Center for Scientific Research - http://www.cnrs.fr


Web: http://guillep.github.io

Phone: <a href="tel:+33%206%2052%2070%2066%2013" value="+33652706613" target="_blank">+33 06 52 70 66 13




--
Cyril Ferlicot
https://ferlicot.fr

http://www.synectique.eu
2 rue Jacques Prévert 01,
59650 Villeneuve d'ascq France
Reply | Threaded
Open this post in threaded view
|

Re: ZIPArchive usage + FileSystem memory

Juraj Kubelka
In reply to this post by Guillermo Polito
Thank you Guillermo. I see that you already assigned the case https://pharo.fogbugz.com/f/cases/20253/MemoryFileSysteFile-shuold-return-a-MultiByteFileStream-as-readStream 

Cheers,
Juraj

On Nov 30, 2017, at 06:10, Guillermo Polito <[hidden email]> wrote:

Hi Juraj,

The file streams opened in a memory file system are not polymorphic with the ones in a disk file system :(.

Can you open an issue and assing it to me? I'll work soon on making all of them work and yield binary streams.

On Wed, Nov 29, 2017 at 9:06 PM, Juraj Kubelka <[hidden email]> wrote:
Hi,

I can successfully use ZipArchive like the following

-=-=-
zip := ZipArchive new.
{ 'file1.txt'. 'file2.txt'. 'file3.txt' } do: [ :eachFile |
        | member |
        member := zip addString: eachFile, ' contents' as: eachFile.
        member desiredCompressionMethod: ZipArchive compressionDeflated ].
file := FileLocator temp / 'archive.zip'.
zip writeTo: file writeStream.
file.
-=-=-

What I should do to make it work while using FileSystem memory?

-=-=-
zip := ZipArchive new.
{ 'file1.txt'. 'file2.txt'. 'file3.txt' } do: [ :eachFile |
        | member |
        member := zip addString: eachFile, ' contents' as: eachFile.
        member desiredCompressionMethod: ZipArchive compressionDeflated ].
fileSystem := FileSystem memory.
file := fileSystem root / 'archive.zip'.
file writeStreamDo: [ :stream |
        zip writeTo: stream ].
-=-=-

There is "Improper store into indexable object” as it tries to store a number in ByteString.
Thanks!
Juraj





--
   
Guille Polito
Research Engineer


Centre de Recherche en Informatique, Signal et Automatique de Lille
CRIStAL - UMR 9189
French National Center for Scientific Research - http://www.cnrs.fr

Phone: +33 06 52 70 66 13