Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
sitemap-stream
Advanced tools
SitemapStream is a simple and fast tool that build sitemaps using streams.
It automatically creates separated files, following the Google specifications
You can find information about the sitemap's syntax here (you'll find the authorized values the #inject method can receive).
Notes:
npm i sitemap-stream
{
sitemapDirectoryUrl: String,
limit: Number, // (default: 50000)
isMobile: Boolean, // (default: false)
outputFolder: String // (default: './')
toCompress: Boolean // (default: true)
}
Url Case:
// The url
Options Case:
{
url: String, // (required)
changeFreq: String,
priority: String
}
Useful if you want to start writing a new sitemap using the same SitemapStream instance
SitemapStream use streams, so it emit events to let you know what happens. Here are the events you can listen to:
sg.on('error', err => {
console.error(`Something wrong happened: ${err}`);
});
let i = 0;
function injectUrls() {
while (i<1000000) {
const isInjected = sg.inject(`http://test-${i}.com`);
if (!isInjected) return i;
i++;
}
}
sg.on('drain', () => {
console.info(`Because we have injected a big amount of lines in a short time, the stream could need to be drained, in this case, the sg#inject method returns false and the drain event is emitted when the stream is ready to write again`);
injectUrls();
});
injectUrls();
sg.on('sitemap-created', path => {
console.info(`A sitemap file has just been written here: ${path}`);
});
sg.on('sitemap-index', path => {
console.info(`A sitemapindex file has just been written here: ${path}`);
});
sg.on('done', nbFiles => {
console.info(`The job is done, we have written ${nbFiles} files !`);
});
Basic
const sg = require('sitemap-stream')();
sg.inject('/some-path');
sg.inject({ url: '/another-path' });
sg.inject({ url: '/my-last-path', changeFreq: 'daily', priority: 0.7 });
sg.done();
With options
const sg = require('sitemap-stream')({ isMobile: true });
sg.inject('/some-path');
sg.inject({ url: '/another-path' });
sg.inject({ url: '/my-last-path', changeFreq: 'daily', priority: 0.7 });
sg.done();
With Events
const sg = require('sitemap-stream')();
sg.on('sitemap-created', (fileName) => {
// This listener will be trigger twice, one when the first 50 000 urls will be injected, and another time when you'll call the #done method
console.log('A sitemap has been created !');
});
sg.on('sitemapindex-index', () => {
// When listener will be trigger once the sitemapindex file will be written
console.log('The sitemapindex has been created, we are done !');
});
sg.on('done', () => {
console.info('Everything is done !');
});
for (let i=0; i<60000; i++) sg.inject(`/some-path-${i}`);
sg.done();
[2.0.1] - 2016-05-31
FAQs
Simple and fast sitemap stream that respects google rules
The npm package sitemap-stream receives a total of 13 weekly downloads. As such, sitemap-stream popularity was classified as not popular.
We found that sitemap-stream 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.