Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
multi-sitemap
Advanced tools
Painless creation of large dynamic sitemaps that consist of multiple files.
Painless creation of large dynamic sitemaps that consist of multiple files.
SitemapWriterXml
, SitemapWriterTxt
or build your own.import {SitemapProcessor, SitemapWriterXml} from 'multi-sitemap';
(async () => {
const processor = new SitemapProcessor({
publicDirectoryUrl: '/sitemap',
writer: new SitemapWriterXml({directory: './static/sitemap'});
});
await processor.addStatic({
name: 'pages',
entries: ['/', '/about']
});
await processor.addDynamic({
name: 'products',
reader: new SitemapProductsReader()
});
await processor.addIndex();
})();
All methods of SitemapProcessor
return promises that should be waited for before calling other methods. The addIndex
method should be called last, as this is the time the processor knows about all child sitemaps.
Create a reader class that implements the following interface:
interface ISitemapReader {
hasNext(): boolean;
getNext(): Promise<SitemapEntryConfig[]>;
}
// Given the following types:
type SitemapEntryConfig = /* url */ string | ISitemapEntry;
interface ISitemapEntry {
url: string;
lastModified?: Date;
changeFrequency?:
| 'always'
| 'hourly'
| 'daily'
| 'weekly'
| 'monthly'
| 'yearly'
| 'never';
priority?: number;
}
An instance of such a class can be passed to the sitemap processor. An example would be:
/**
* Fetches 7 pages of products, each consisting
* of 20 entities that are written to a sitemap.
*/
class SitemapProductsReader {
i = 0;
hasNext() {
return this.i < 7;
}
getNext() {
const size = 20;
const offset = this.i * size;
this.i++;
return fetch(`/api/products?offset=${offset}&size=${size}`)
.then(products => products.map(product => `/products/${product.id}`))
}
}
processor.addDynamic({
name: 'products',
reader: new SitemapProductsReader()
});
FAQs
Painless creation of large dynamic sitemaps that consist of multiple files.
The npm package multi-sitemap receives a total of 0 weekly downloads. As such, multi-sitemap popularity was classified as not popular.
We found that multi-sitemap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.