Package Exports
- @jsonjoy.com/fs-print
- @jsonjoy.com/fs-print/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jsonjoy.com/fs-print) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@jsonjoy.com/fs-print
File system tree printer - print a file system structure as a tree.
Provides a simple API to print any filesystem implementing the FsSynchronousApi interface
as a formatted tree structure, useful for debugging and visualization.
Installation
npm install @jsonjoy.com/fs-printUsage
import { toTreeSync } from '@jsonjoy.com/fs-print';
import { memfs } from 'memfs';
const { fs } = memfs({
'/readme.md': '...',
'/src/index.ts': '...',
'/src/util.ts': '...',
});
console.log(toTreeSync(fs));Output:
/
├─ src/
│ ├─ index.ts
│ └─ util.ts
└─ readme.mdOptions
You can customize the output with options:
toTreeSync(fs, {
dir: '/src', // Starting directory (default: '/')
depth: 2, // Maximum depth to traverse (default: 10)
separator: '/', // Path separator (default: '/')
tab: ' ', // Indentation string (default: '')
sort: true, // Sort entries (default: true)
});License
Apache-2.0