
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
gulp-rev-outdated
Advanced tools
Old static asset revision files filter.
$ npm install --save-dev gulp-rev-outdated
We can use gulp-rev to cache-bust several assets. Every modification of source files caused a new revisioned asset creation. In case of using separate http://static.exsample.com/ domain for distributing static assets we have some problem with a lot of accumulated revisioned asset files. If we have several different frontends (e.q. [www-1.exsample.com, www-2.exsample.cpm, ... www-12.exsample com]) worked with different software releases, We can't remove all revisioned asset files on static.exsample.com. We need to save number of recent revisioned assets. gulp-rev-outdated filter revisioned assets and exclude parametrised quantity of recent files for removing.
Takes one parameter [ keepQuantity ] - number of saved recent files. Default value == 2.
var gulp = require('gulp');
var gutil = require('gulp-util');
var rimraf = require('rimraf');
var revOutdated = require('gulp-rev-outdated');
var path = require('path');
var through = require('through2');
function cleaner() {
return through.obj(function(file, enc, cb){
rimraf( path.resolve( (file.cwd || process.cwd()), file.path), function (err) {
if (err) {
this.emit('error', new gutil.PluginError('Cleanup old files', err));
}
this.push(file);
cb();
}.bind(this));
});
}
gulp.task('clean', function() {
gulp.src( ['dist/js/vendors*.js'], {read: false})
.pipe( revOutdated(1) ) // leave 1 latest asset file
.pipe( cleaner() );
gulp.src( ['dist/js/bundle*.js'], {read: false})
.pipe( revOutdated(3) ) // leave 3 recent assets
.pipe( cleaner() );
gulp.src( ['dist/css/*.css'], {read: false})
.pipe( revOutdated() ) // leave 2 recent assets (default value)
.pipe( cleaner() );
return;
});
It's also possible to pass in all your asset files at once:
[...]
gulp.task('clean', function() {
gulp.src( ['dist/**/*.*'], {read: false})
.pipe( revOutdated(1) ) // leave 1 latest asset file for every file name prefix.
.pipe( cleaner() );
return;
});
gulp.src option read false prevents gulp to read the contents of the file and makes this task a lot faster. If you need the file and it's contents after cleaning in the same stream, do not set the read option to false.
FAQs
Old static asset revision files filter
We found that gulp-rev-outdated 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 researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.