Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More →
Socket
Sign inDemoInstall
Socket

directory-tree

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

directory-tree - npm Package Compare versions

Comparing version 3.2.2 to 3.3.0

46

index.d.ts

@@ -1,9 +0,17 @@

import { Stats } from 'fs';
import { Stats } from "fs";
declare function directoryTree(
interface IObj {
[key: string]: any;
}
declare function directoryTree<
TCustomFile extends IObj = IObj,
TCustomDir extends IObj = IObj,
TCustomResult = TCustomFile & TCustomDir
>(
path: string,
options ? : directoryTree.DirectoryTreeOptions,
onEachFile ? : directoryTree.DirectoryTreeCallback,
onEachDirectory ? : directoryTree.DirectoryTreeCallback,
): directoryTree.DirectoryTree;
options?: directoryTree.DirectoryTreeOptions,
onEachFile?: directoryTree.DirectoryTreeCallback<TCustomFile>,
onEachDirectory?: directoryTree.DirectoryTreeCallback<TCustomDir>
): directoryTree.DirectoryTree<TCustomResult>;

@@ -13,3 +21,3 @@ export as namespace directoryTree;

declare namespace directoryTree {
export interface DirectoryTree {
export interface DirectoryTree<C extends IObj = IObj> {
path: string;

@@ -19,18 +27,24 @@ name: string;

type: "directory" | "file";
children ? : DirectoryTree[];
children?: DirectoryTree<C>[];
extension?: string;
isSymbolicLink?: boolean;
custom: { [key: string]: any };
custom: C;
}
export interface DirectoryTreeOptions {
normalizePath ? : boolean;
exclude ? : RegExp | RegExp[];
attributes ? : (keyof Stats | "type" | "extension")[];
extensions ? : RegExp;
followSymlinks ? : boolean;
depth ? : number;
normalizePath?: boolean;
exclude?: RegExp | RegExp[];
attributes?: (keyof Stats | "type" | "extension")[];
extensions?: RegExp;
followSymlinks?: boolean;
depth?: number;
}
export type DirectoryTreeCallback = (item: DirectoryTree, path: string, stats: Stats) => void;
export type DirectoryTreeCallback<TCustom extends IObj = IObj> = (
item: DirectoryTree<TCustom>,
path: string,
stats: Stats
) => void;
}
export = directoryTree;
{
"name": "directory-tree",
"version": "3.2.2",
"version": "3.3.0",
"description": "Convert a directory tree to a JS object.",

@@ -5,0 +5,0 @@ "repository": {

@@ -181,3 +181,3 @@ [![Build Status](https://api.travis-ci.com/mihneadb/node-directory-tree.svg?branch=master)](https://api.travis-ci.com/mihneadb/node-directory-tree.svg?branch=master)

) => {
item.custom.id = createHash('sha1').update(path).digest('base64');
item.custom = {id: createHash('sha1').update(path).digest('base64')};
};

@@ -184,0 +184,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡ī¸ by Socket Inc