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

@types/vinyl

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/vinyl

TypeScript definitions for vinyl 1.1.0

  • 1.1.25-alpha
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
894K
increased by8.57%
Maintainers
1
Weekly downloads
 
Created

What is @types/vinyl?

@types/vinyl provides TypeScript type definitions for the 'vinyl' package, which is a virtual file format used in the Node.js ecosystem, particularly in build systems like Gulp. It allows developers to handle file operations in memory, making it easier to manipulate files without writing them to disk.

What are @types/vinyl's main functionalities?

Creating a Vinyl File

This feature allows you to create a new Vinyl file object with specified properties such as current working directory (cwd), base path, file path, and contents.

const Vinyl = require('vinyl');
const file = new Vinyl({
  cwd: '/',
  base: '/test/',
  path: '/test/file.js',
  contents: Buffer.from('console.log("Hello, world!");')
});
console.log(file.path); // '/test/file.js'
console.log(file.contents.toString()); // 'console.log("Hello, world!");'

Checking File Properties

This feature allows you to check various properties of a Vinyl file object, such as whether its contents are a Buffer, a Stream, or null.

const Vinyl = require('vinyl');
const file = new Vinyl({
  path: '/test/file.js',
  contents: Buffer.from('console.log("Hello, world!");')
});
console.log(file.isBuffer()); // true
console.log(file.isStream()); // false
console.log(file.isNull()); // false

Cloning a Vinyl File

This feature allows you to create a clone of an existing Vinyl file object, duplicating its properties and contents.

const Vinyl = require('vinyl');
const file = new Vinyl({
  path: '/test/file.js',
  contents: Buffer.from('console.log("Hello, world!");')
});
const clonedFile = file.clone();
console.log(clonedFile.path); // '/test/file.js'
console.log(clonedFile.contents.toString()); // 'console.log("Hello, world!");'

Other packages similar to @types/vinyl

FAQs

Package last updated on 04 Jul 2016

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