cloudflare-go icon indicating copy to clipboard operation
cloudflare-go copied to clipboard

Streaming Worker Content

Open abiodunakande opened this issue 1 year ago • 0 comments

Current cloudflare-go version

v0.87.0

Description

Currently having some issues with the worker functions on the API where a string is expected/being returned for the script content.

Could we modify the create and update params to take an interface{} rather than string to enable us to stream worker content to the api.

Use cases

Workers can be up to 10Mb in size and buffering this within my application seems wrong.

Potential cloudflare-go usage

type CreateWorkerParams struct {
        ...
	Script     interface{}
        ...
}
func (api *API) UploadWorker(....... {
    body, w := io.Pipe
    ... 
     go func() {
      api.makeRequest(....body....)
     }
     // write to body...
}

References

No response

abiodunakande avatar Feb 07 '24 17:02 abiodunakande