Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
tree-visit
Advanced tools
A filesystem utility, supporting batch & in-memory operations.
npm install --save buffs
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
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
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
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
FAQs
A tree traversal library.
The npm package tree-visit receives a total of 5,983 weekly downloads. As such, tree-visit popularity was classified as popular.
We found that tree-visit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.