You can do

response.stream(...,chunk_size=4000)

On Apr 5, 5:57 am, Iceberg <[email protected]> wrote:
> Hi Massimo,
>
> I always follow the sample here to write my streaming code:
>  http://www.web2py.com/examples/default/examples#streaming_examples
>
> Today I happened to find that this approach does not handle "HTTP/1.1
> 206 PARTIAL CONTENT" correctly. After some try and search, I found
> this:
>  http://groups.google.com/group/web2py/msg/8fa154c4cf1a3a38
>
> Therefore I suggest to adjust the stream sample. How about something
> like these?
>
> ============ START =============
> Example 48
>
> It is very easy in web2py to stream large files. Here is an example of
> a controller that does so:
>
> def streamer():
>     return response.stream(open
> ('largefile.mpg4','rb'),chunk_size=4096)
> By default all static files and files stored in 'upload' fields in the
> database are streamed when larger than 1MByte.
>
> Even better, if you use:
> def streamer():
>     return response.stream('path_to_a_largefile.mpg4',request=request)
>
> web2py automatically and transparently handles PARTIAL_CONTENT and
> RANGE requests.
>
> ========== THE END ===============
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to