@@ -3,7 +3,7 @@ mutable struct Easy
33 input :: Union{Vector{UInt8},Nothing}
44 ready :: Threads.Event
55 seeker :: Union{Function,Nothing}
6- output :: Channel{Vector{UInt8}}
6+ output :: IO
77 progress :: Function
88 req_hdrs :: Ptr{curl_slist_t}
99 res_hdrs :: Vector{String}
1313
1414const EMPTY_BYTE_VECTOR = UInt8[]
1515
16- function Easy (progress:: Union{Function,Nothing} )
16+ function Easy (
17+ output:: IO ,
18+ progress:: Union{Function,Nothing} ,
19+ )
1720 easy = Easy (
1821 curl_easy_init (),
1922 EMPTY_BYTE_VECTOR,
2023 Threads. Event (),
2124 nothing ,
22- Channel {Vector{UInt8}} ( Inf ) ,
25+ output ,
2326 something (progress, (_, _, _, _) -> nothing ),
2427 C_NULL ,
2528 String[],
@@ -356,12 +359,11 @@ function write_callback(
356359 count :: Csize_t ,
357360 easy_p :: Ptr{Cvoid} ,
358361):: Csize_t
362+ @assert size == sizeof (Cchar)
359363 easy = unsafe_pointer_to_objref (easy_p):: Easy
360- n = size * count
361- buf = Array {UInt8} (undef, n)
362- ccall (:memcpy , Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, Csize_t), buf, data, n)
363- put! (easy. output, buf)
364- return n
364+ buf = unsafe_wrap (Vector{Cchar}, data, size* count)
365+ write (easy. output, buf)
366+ return size* count
365367end
366368
367369function progress_callback (
0 commit comments