
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Convert an array of objects into a persistent or temporary directory structure
Convert an array of objects into a persistent or temporary directory structure.
fsify
creates a persistent or temporary directory structure from an array of objects. It's like the opposite of the Linux and Unix tree
command.
npm install fsify
.
āāā dirname
āĀ Ā āāā filename
āāā filename
const fsify = require('fsify')()
const structure = [
{
type: fsify.DIRECTORY,
name: 'dirname',
contents: [
{
type: fsify.FILE,
name: 'filename',
contents: 'data'
}
]
},
{
type: fsify.FILE,
name: 'filename',
contents: 'data'
}
]
fsify(structure)
.then((structure) => console.log(structure))
.catch((error) => console.error(error))
.
āāā dirname
āāā dirname
āāā filename
const fsify = require('fsify')()
const structure = [
{
type: fsify.DIRECTORY,
name: 'dirname',
contents: [
{
type: fsify.DIRECTORY,
name: 'dirname',
contents: [
{
type: fsify.FILE,
name: 'filename'
}
]
}
]
}
]
fsify(structure)
.then((structure) => console.log(structure))
.catch((error) => console.error(error))
dirname/
āāā filename
const fsify = require('fsify')({
cwd: 'dirname/',
persistent: false
})
const structure = [
{
type: fsify.FILE,
name: 'filename'
}
]
fsify(structure)
.then((structure) => console.log(structure))
.catch((error) => console.error(error))
tree
tree
is a Linux and Unix command that lists the contents of directories in a tree-like format. It's a helpful CLI to view the structure of your file system.
tree -J --noreport ./* > tree.json
const fs = require('fs')
const fsify = require('fsify')()
const structure = require('./tree')
fsify(structure)
.then((structure) => console.log(structure))
.catch((error) => console.error(error))
const fsify = require('fsify')()
const fsify = require('fsify')({
cwd: process.cwd(),
persistent: true,
force: false
})
options
{?Object}
Options.
cwd
{?String}
- Custom relative or absolute path. Defaults to process.cwd()
.persistent
{?Boolean}
- Keep directories and files even when the process exists. Defaults to true
.force
{?Boolean}
- Allow deleting the current working directory and outside. Defaults to false
.{Function}({?Array})
fsify instance.const structure = [
{
type: fsify.FILE,
name: 'filename'
}
]
fsify(structure)
.then((structure) => console.log(structure))
.catch((error) => console.error(error))
structure
{?Array}
Array of objects containing information about a directory or file.{Promise<Array>}
A promise that resolves a structure. Equal to the input structure, but parsed and with a absolute path as the name.A structure is an array of objects that represents a directory structure. Each object must contain information about a directory or file.
The structure ā¦
.
āāā dirname
āĀ Ā āāā filename
āāā filename
⦠is equal to ā¦
[
{
type: fsify.DIRECTORY,
name: 'dirname',
contents: [
{
type: fsify.FILE,
name: 'filename',
contents: 'data'
}
]
},
{
type: fsify.FILE,
name: 'filename',
contents: 'data'
}
]
A directory must have the type
of a directory and a name
. It can also contain another nested structure in its contents
and a mode
.
{
type: fsify.DIRECTORY,
name: 'dirname',
mode: 0o777,
contents: []
}
A file must have the type
of a file and a name
. It can also contain contents
(data of the file). encoding
, mode
and flag
will be passed directly to fs.writeFile
.
{
type: fsify.FILE,
name: 'filename',
contents: 'data',
encoding: 'utf8',
mode: 0o666,
flag: 'w'
}
[5.0.0] - 2021-12-11
tree
example in README (#38)FAQs
Convert an array of objects into a persistent or temporary directory structure
The npm package fsify receives a total of 206 weekly downloads. As such, fsify popularity was classified as not popular.
We found that fsify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Ā It has 1 open source maintainer 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
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.