How to use the sitemap.streamToPromise function in sitemap

To help you get started, we’ve selected a few sitemap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cswbrian / district-councils-dashboard / ssr / server / lib / sitemap.js View on Github external
getDistricts().then(urls => {
        // Add URLs
        urls.forEach(url => {
          smStream.write(url)
        })
        smStream.end()

        // cache the response
        streamToPromise(pipeline).then(sm => sitemap = sm)
        // stream the response
        pipeline.pipe(res).on('error', (err) => { throw err })
      })
    } catch (err) {