or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

dest.mdindex.mdsrc.mdsymlink.md

index.mddocs/

0

# vinyl-fs

1

2

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.

3

4

## Package Information

5

6

- **Package Name**: vinyl-fs

7

- **Package Type**: npm

8

- **Language**: JavaScript

9

- **Installation**: `npm install vinyl-fs`

10

11

## Core Imports

12

13

```javascript

14

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

15

```

16

17

For ES modules:

18

19

```javascript

20

import vfs from 'vinyl-fs';

21

```

22

23

Individual imports:

24

25

```javascript

26

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

27

```

28

29

## Basic Usage

30

31

```javascript

32

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

33

34

// Read files using glob patterns and write to destination

35

vfs.src(['./src/**/*.js', '!./src/vendor/*.js'])

36

.pipe(vfs.dest('./output'));

37

38

// Create symbolic links

39

vfs.src('./src/**/*.js')

40

.pipe(vfs.symlink('./links'));

41

```

42

43

## Architecture

44

45

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

46

47

- **Stream-based Architecture**: All operations return Node.js streams for composable file processing

48

- **Vinyl Integration**: Works with Vinyl File objects for consistent file representation

49

- **Glob Pattern Support**: Uses glob-stream for flexible file selection

50

- **Transform Pipelines**: Each method creates stream pipelines with specialized transform streams

51

- **Options Resolution**: Dynamic options resolution supporting both static values and functions

52

- **Cross-platform Compatibility**: Handles platform-specific behaviors (Windows junctions, Unix permissions)

53

54

## Capabilities

55

56

### File Reading (src)

57

58

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

59

60

```javascript { .api }

61

function src(globs, options);

62

```

63

64

[File Reading](./src.md)

65

66

### File Writing (dest)

67

68

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

69

70

```javascript { .api }

71

function dest(outFolder, options);

72

```

73

74

[File Writing](./dest.md)

75

76

### Symbolic Links (symlink)

77

78

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

79

80

```javascript { .api }

81

function symlink(outFolder, options);

82

```

83

84

[Symbolic Links](./symlink.md)