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.
gulp-file-contents-to-keys
Advanced tools
Input some files, output ES6 exports of their contents. Very helpful when working with HTML template files, so each of them could be imported using ES6 syntax.
I recommend using rollup for ES6 modules bundling.
$ npm install gulp-file-contents-to-modules
Given a nested directory of files like so,
my-files
├── bar.html
├── foo.html
└── my-folder
└── baz.html
gulp-file-contents-to-modules reads in each file, and outputs a single JSON file representing the contents of each file within the folder. When a directory is encountered, it becomes a nested object within the JSON blob, like so:
export var bar = "This is bar.";
export var foo = "This is foo.\r\n";
export var my-folder__baz = "This is baz.\r\n";
For example, to read in the contents of the my-files
folder and output dist/contents.js
, simply add the following gulp task inside gulpfile.js
:
var gulp = require('gulp');
var fc2modules = require('gulp-file-contents-to-modules');
gulp.task('default', function() {
gulp.src('templates/**/*')
.pipe(fc2modules({
compile : true, // 'true' (use '_.template') or pass any other string to wrap the template string with
minify : true, // remove new lines and whitespaces between tags
})
.pipe(gulp.dest('./dist/'));
});
Simply run the following and you're done:
$ gulp
MIT
FAQs
convert files into key/value objects where key is filename, value is the content
The npm package gulp-file-contents-to-keys receives a total of 1 weekly downloads. As such, gulp-file-contents-to-keys popularity was classified as not popular.
We found that gulp-file-contents-to-keys 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.