0.13.0 • Published 1 year ago

react-guidebook v0.13.0

Weekly downloads
59
License
MIT
Repository
github
Last release
1 year ago

buffs

A filesystem utility, supporting batch & in-memory operations.

npm install --save buffs

API

Every API works both on the real filesystem and in-memory filesystems created by createFs.


copy

Copy a file or directory from the source to the target filesystem recursively.

Type: (source: IFS, target: IFS, sourcePath: string, targetPath?: string, options?: CopyOptions) => void

Example

import fs from 'fs'
import process from 'process'
import { copy, createFs } from 'buffs'

// Create files using in-memory filesystem
const { fs: source } = createFs({
  '/a.txt': 'a',
  '/b/b.txt': 'b',
})

// Copy all files from source to your current directory
copy(source, fs, '/', process.cwd())

createFs

Create an in-memory filesystem.

This is a wrapper around memfs.

Type: (json: DirectoryJSON = {}, cwd?: string) => { volume: VolumeType; fs: IFS }

import fs from 'fs'
import { createFs } from 'buffs'

// Create files using in-memory filesystem
const { volume, fs } = createFs({
  '/a.txt': 'a',
  '/b/b.txt': 'b',
})

describe

Create a description of all files in the source filesystem.

Type: (source: IFS, filePath: string) => string

Example

import { describe, createFs } from 'buffs'

// Create files using in-memory filesystem
const { fs: source } = createFs({
  '/a.txt': 'a',
  '/b/b.txt': 'b',
})

const description = describe(source, '/')

console.log(description)
// ├── a.txt
// └── b / b.txt

describeComparison

Create a description of all files in the "updated" source filesystem, relative to the state of the "original" target filesystem.

Type: (source: IFS, target: IFS, filePath: string, { colorize?: boolean }): string

Example

import { describeComparison, createFs } from 'buffs'

const { fs: source } = createFs({
  '/a.txt': 'a',
  '/b/b.txt': 'b',
})

const { fs: target } = createFs({
  '/b/b.txt': 'b',
})

const description = describeComparison(source, target, '/', { colorize: true })

console.log(description)
// ├── a.txt (printed in green, since it was "added")
// └── b / b.txt
0.13.0

1 year ago

0.12.1

1 year ago

0.11.0

2 years ago

0.11.1

2 years ago

0.12.0

2 years ago

0.10.6

3 years ago

0.10.5

3 years ago

0.10.4

3 years ago

0.10.2

3 years ago

0.10.3

3 years ago

0.10.1

3 years ago

0.10.0

3 years ago

0.9.5

3 years ago

0.9.4

3 years ago

0.9.3

3 years ago

0.9.2

3 years ago

0.9.1

3 years ago

0.9.0

3 years ago

0.7.0

3 years ago

0.8.0

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.3

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.0

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.4-beta

4 years ago

0.2.3-beta

4 years ago

0.2.2-beta

4 years ago

0.2.1-beta

4 years ago

0.2.0-beta

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.20

4 years ago

0.0.18

4 years ago

0.0.19

4 years ago

0.0.14

4 years ago

0.0.15

4 years ago

0.0.16

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.5

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.4

4 years ago

0.0.1

4 years ago