or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

dest.mdindex.mdsrc.mdsymlink.md
tile.json

tessl/npm-vinyl-fs

Vinyl adapter for the file system providing streaming file operations.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/vinyl-fs@4.0.x

To install, run

npx @tessl/cli install tessl/npm-vinyl-fs@4.0.0

index.mddocs/

vinyl-fs

vinyl-fs is a Vinyl adapter for the file system that provides streaming file operations. It serves as a bridge between the file system and Vinyl (a virtual file format), offering three main methods for file manipulation through Node.js streams with support for glob patterns, sourcemaps, encoding transformations, and symbolic links.

Package Information

  • Package Name: vinyl-fs
  • Package Type: npm
  • Language: JavaScript
  • Installation: npm install vinyl-fs

Core Imports

const vfs = require('vinyl-fs');

For ES modules:

import vfs from 'vinyl-fs';

Individual imports:

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

Basic Usage

const vfs = require('vinyl-fs');

// Read files using glob patterns and write to destination
vfs.src(['./src/**/*.js', '!./src/vendor/*.js'])
  .pipe(vfs.dest('./output'));

// Create symbolic links
vfs.src('./src/**/*.js')
  .pipe(vfs.symlink('./links'));

Architecture

vinyl-fs is built around the Vinyl ecosystem and Node.js streams:

  • Stream-based Architecture: All operations return Node.js streams for composable file processing
  • Vinyl Integration: Works with Vinyl File objects for consistent file representation
  • Glob Pattern Support: Uses glob-stream for flexible file selection
  • Transform Pipelines: Each method creates stream pipelines with specialized transform streams
  • Options Resolution: Dynamic options resolution supporting both static values and functions
  • Cross-platform Compatibility: Handles platform-specific behaviors (Windows junctions, Unix permissions)

Capabilities

File Reading (src)

Stream-based file reading with glob pattern support, encoding transformation, and sourcemap handling. Perfect for build systems and file processing workflows.

function src(globs, options);

File Reading

File Writing (dest)

Stream-based file writing with directory creation, permission handling, and sourcemap support. Automatically creates directories and preserves file metadata.

function dest(outFolder, options);

File Writing

Symbolic Links (symlink)

Stream-based symbolic link creation with support for both file and directory symlinks, including Windows junction support.

function symlink(outFolder, options);

Symbolic Links