Sean, On 25 Apr 2012, at 17:13, Sean P. DeNigris wrote:
ZnClient new get: 'https://ci.lille.inria.fr/pharo/job/Cog%20Git%20Tracker/lastSuccessfulBuild/...'.
Reports entity too large. How do I save this file to local disk?
One of the key ideas of Zn for me was to offer a Smalltalk codebase where 'The source will be with you, always' would be true, like it should be true in Smalltalk as a whole. Yes, it throws an entity too large exception, to protect you (or your server). This is a feature ! Open the debugger and you'll see how it is using ZnConstants>>#maximumEntitySize, go look there and lo and behold there is a setter to modify this limit. Furthermore, the ZnEntityTooLarge exception is proceedable. Apparently the download is about 40Mb. So it is possible to get to the ByteArray in an Inspector and do whatever you want, like save it manually. But it would be better to do this in a streaming fashion, like Igor said and save it directly to a file. This should work: FileStream newFileNamed: '/tmp/cog.tgz' do: [ :stream | | entity | stream binary. entity := ZnClient new streaming: true; get: 'https://ci.lille.inria.fr/pharo/job/Cog%20Git%20Tracker/lastSuccessfulBuild/...'; entity. entity writeOn: fileStream ] The entity is actually a ZnStreamingEntity (have a look at its #writeOn: method). You can test is on a smaller file FileStream newFileNamed: '/tmp/pharo.png' do: [ :fileStream | | entity | fileStream binary. entity := ZnClient new streaming: true; get: 'http://www.pharo-project.org/images/pharo.png'; entity. entity writeOn: fileStream ] Now, you are right that there should be some convenience method to make that easier. I'll think about it for a bit and let you know if I can come up with something. HTH, Sven -- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill