MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / streamFile

Method streamFile

plugins/FilePack/FilePackPlugin.py:88–98  ·  view source on GitHub ↗
(self, file)

Source from the content-addressed store, hash-verified

86 return super(UiRequestPlugin, self).actionSiteMedia(path, **kwargs)
87
88 def streamFile(self, file):
89 for i in range(100): # Read max 6MB
90 try:
91 block = file.read(60 * 1024)
92 if block:
93 yield block
94 else:
95 raise StopIteration
96 except StopIteration:
97 file.close()
98 break
99
100
101@PluginManager.registerTo("SiteStorage")

Callers 1

actionSiteMediaMethod · 0.95

Calls 2

readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected