Closed GerardSmit closed 1 year ago
Should I remove the integration test for stream? It seems like having 3 target frameworks and 2 separate tests for byte-array and stream is too much (6 API requests in total). The unit test fails with:
{"message":"You have started too many jobs at once","code":"PARALLEL_JOB_LIMIT_EXCEEDED"}
I just cleaned up that queue and tests went through now.
Looks great, thanks a lot! Could you also update the README here to use a stream instead of a byte array? (including Dispose
)
Done. The preview can be viewed at https://github.com/GerardSmit/cloudconvert-dotnet/tree/feature/upload-stream#uploading-files.
This PR adds the following method to
ICloudConvertAPI
:Currently it's only possible to send a byte-array. Because of this, you have to load the file into memory before sending it to CloudConvert. This is fine for small files but loading large files could be a memory problem.
It's noteworthy that the stream doesn't get disposed by the API, so for example:
In this example the
stream
is still open. You'll have toDispose
the stream yourself (or useusing var stream = ...
).Tests I've added an internal constructor in
RestHelper
and made the internals visible to the Tests-project. This is so I can mock the HTTP-client and check if the stream doesn't get disposed byCloudConvertAPI
.