Amazon-SP-API-CSharp
Amazon-SP-API-CSharp copied to clipboard
SubmitFeedAsync doesn't handle XML as file (and files are fully loaded to memory)
Hi, SubmitFeedAsync doesn't check whether the xmlContentOrFilePath is file path, so XML content always needs to be loaded into memory as a string (and then converted to byte array, so really loads in memory twice). Is this by design?
Ideally we want a way to specify whether its a file, and also change PostFileDataAsync to write from file to stream. Otherwise for very large files a large amount of memory is consumed.
I am happy to do a PR for this - just want to know how best to apprach it?
if (contentType == ContentType.PDF)
{
_ = await PostFileDataAsync(feedCreate.Url, XmlContentOrFilePath, contentType);
}
else if (contentType == ContentType.JSON)
{
_ = await PostFileDataAsync(feedCreate.Url, XmlContentOrFilePath, contentType);
}
else if (contentType == ContentType.TXT)
{
_ = await PostFileDataAsync(feedCreate.Url, XmlContentOrFilePath, contentType);
}
else
{
_ = await PostXMLDataAsync(feedCreate.Url, XmlContentOrFilePath);
}
You Idea is good just write the code and test it then submit PR and i will review it and approve @tank104 Thanks in Advance
Will do this week
Sorry for delay - my thoughts on how to achieve this are here: https://github.com/abuzuhri/Amazon-SP-API-CSharp/pull/401
Haven't fully tested it yet but was keen on your feedback?