Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow creating empty sitemap #394

Open
haegemonia76 opened this issue Jul 13, 2022 · 1 comment
Open

Allow creating empty sitemap #394

haegemonia76 opened this issue Jul 13, 2022 · 1 comment

Comments

@haegemonia76
Copy link

haegemonia76 commented Jul 13, 2022

Is your feature request related to a problem? Please describe.
I'm currently creating a google news sitemap and currently I don't have any news posted on my website.

Is there any usecase that don't allow a sitemap to be empty ?

Is it possible to add an option to no throw an error if the stream has no data ?

if (!this.hasHeadOutput) {
cb(new EmptySitemap());

if (!drain.length) {
reject(new EmptyStream());

@huntharo
Copy link
Contributor

I'm probably missing something here. But streamToPromise is kinda goofy.

I'd suggest not using streamToPromise at all and using import { finished } from 'stream/promises;' and await finished(stream);.

I'm guessing but I would not expect finished to throw if no data is written to the stream.

I can't think of any good reason why you have to use streamToPromise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants