summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-11 22:31:07 +0800
committerruki <[email protected]>2022-05-11 22:31:07 +0800
commit278ea7627a3c76e2712c1117ced1bdc3045bdb9d (patch)
tree7bf9c4f4238d3cc58a8634a5e296654bc81ec249 /xmake/modules
parent505f48ad7fc2de2bf837988868aca881843be3c9 (diff)
send and recv stream files
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/private/service/stream.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/xmake/modules/private/service/stream.lua b/xmake/modules/private/service/stream.lua
index 8cb802ab8..aab400558 100644
--- a/xmake/modules/private/service/stream.lua
+++ b/xmake/modules/private/service/stream.lua
@@ -202,6 +202,16 @@ function stream:send_file(filepath, opt)
return ok
end
+-- send files
+function stream:send_files(filepaths, opt)
+ for _, filepath in ipairs(filepaths) do
+ if not self:send_file(filepath, opt) then
+ return false
+ end
+ end
+ return true
+end
+
-- recv the given bytes
function stream:recv(buff, size)
assert(size <= buff:size(), "too large size(%d)", size)
@@ -348,6 +358,16 @@ function stream:recv_file(filepath)
end
end
+-- recv files
+function stream:recv_files(filepaths)
+ for _, filepath in ipairs(filepaths) do
+ if not self:recv_file(filepath) then
+ return false
+ end
+ end
+ return true
+end
+
-- recv compressed file
function stream:_recv_compressed_file(lz4_stream, filepath, size)
local buff = self._BUFF