Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vinyl-fs

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vinyl-fs

Vinyl adapter for the file system.

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.5M
increased by25.42%
Maintainers
2
Weekly downloads
 
Created

What is vinyl-fs?

The vinyl-fs npm package is a module that allows you to handle file operations in a virtual file format known as Vinyl. It is commonly used in the Gulp build system to read and write files, watch file changes, and manage file streams. Vinyl-fs abstracts file details and provides a consistent API to manipulate files regardless of the source (local file system, remote, etc.).

What are vinyl-fs's main functionalities?

Reading Files

This feature allows you to read files from the filesystem using glob patterns. The example code demonstrates how to read all JavaScript files in the 'src' directory and log their paths.

const { src } = require('vinyl-fs');

src('src/*.js')
  .on('data', function(file) {
    console.log(file.path);
  });

Writing Files

This feature enables writing files to a specified directory. The code sample shows how to copy all JavaScript files from the 'src' directory to the 'output' directory.

const { src, dest } = require('vinyl-fs');

src('src/*.js')
  .pipe(dest('output/'));

Watching File Changes

This feature is useful for setting up a watch on files to perform actions when changes are detected. The example sets up a watcher on all JavaScript files in the 'src' directory and logs a message whenever a file changes.

const { watch } = require('vinyl-fs');

watch('src/**/*.js', function(cb) {
  console.log('File changed.');
  cb();
});

Other packages similar to vinyl-fs

Keywords

FAQs

Package last updated on 25 Jun 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc