Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
vinyl-buffer
Advanced tools
The vinyl-buffer npm package is used to convert streaming vinyl file objects into buffered vinyl file objects. This is particularly useful in build systems like Gulp where you may need to perform operations that require the entire file to be in memory.
Convert Stream to Buffer
This feature allows you to convert a stream into a buffer so that you can perform operations that require the entire file to be in memory. In this example, the vinyl-buffer package is used to convert the stream from browserify into a buffer so that it can be minified using gulp-uglify.
const gulp = require('gulp');
const vinylBuffer = require('vinyl-buffer');
const uglify = require('gulp-uglify');
const source = require('vinyl-source-stream');
const browserify = require('browserify');
gulp.task('scripts', function() {
return browserify('src/app.js')
.bundle()
.pipe(source('bundle.js'))
.pipe(vinylBuffer())
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
The gulp-buffer package is similar to vinyl-buffer in that it also converts streaming vinyl file objects into buffered vinyl file objects. It is specifically designed to be used within Gulp pipelines, making it a more specialized alternative to vinyl-buffer.
The through2 package is a general-purpose stream utility that allows you to transform and manipulate streams. While it is not specifically designed for converting vinyl file objects, it can be used to achieve similar functionality by writing custom transformation functions.
The gulp-streamify package is used to convert a stream into a buffered stream, allowing you to use plugins that only support buffered vinyl file objects. It is similar to vinyl-buffer but is designed to work specifically within Gulp pipelines.
Convert streaming vinyl files to use buffers.
An alternative to gulp-streamify that you can pipe to, instead of being required to wrap your streams.
var browserify = require('browserify')
var source = require('vinyl-source-stream')
var buffer = require('vinyl-buffer')
var uglify = require('gulp-uglify')
var size = require('gulp-size')
var gulp = require('gulp')
gulp.task('build', function() {
var bundler = browserify('./index.js')
return bundler.pipe()
.pipe(source('index.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(size())
.pipe(gulp.dest('dist/'))
})
vinylBuffer()
Creates a transform stream that takes vinyl files as input, and outputs
modified vinyl files as output. If file.isStream()
, file.contents
will
be converted to a Buffer
before being emitted again – otherwise, the file
will be emitted immediately.
MIT. See LICENSE.md for details.
FAQs
Convert streaming vinyl files to use buffers
The npm package vinyl-buffer receives a total of 104,782 weekly downloads. As such, vinyl-buffer popularity was classified as popular.
We found that vinyl-buffer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.