Output Algolia Sitemap to stream

I’m using the algolia-sitemap node package to generate an XML sitemap. Is it possible to output the sitemap to a stream or something other than a file?

I’m running the sitemap code from an Azure function, which, when deployed as a zip package will not have access to write/modify files. I’m looking to write the sitemap out to Azure Blob Storage.

Thanks.

Hi @alex.w, welcome to the community!

I understand you’re using the algolia-sitemap package. As it’s currently written, it will output to a single file without options to stream.

However, you could use the code found here as a base and the modify it to write in a stream rather than aggregate all hits and then write to a file.

The generator is making use of the browse function to read all of the records in an index, transform them into a entires in a sitemap, aggregate them and then write the aggregated data. Instead, you could be writing/sending these entries each time a batch of record is found from the browse function.

I know this is very high level, but I hope it helps. Please feel free to ask further questions!