• Version 2.0.1
  • Published
  • 41.5 kB
  • 5 dependencies
  • MIT license


npm i fs-tree-diff
yarn add fs-tree-diff
pnpm add fs-tree-diff


Backs out file tree changes



class FSTree

class FSTree<T extends BaseEntry = DefaultEntry> {}


    constructor(options?: { entries?: T[]; sortAndExpand?: boolean });

      property entries

      entries: T[];

        property size

        readonly size: number;

          method addEntries

          addEntries: (entries: T[], options?: FSTree.StaticOptions) => void;

            method addPaths

            addPaths: (paths: string[], options?: FSTree.StaticOptions) => void;

              method applyPatch

              static applyPatch: (
              input: string,
              output: string,
              patch: FSTree.Patch,
              _delegate?: FSTree.PatchDelegate
              ) => void;

                method calculateAndApplyPatch

                calculateAndApplyPatch: (
                otherFSTree: FSTree<T>,
                input: string,
                output: string,
                delegate?: FSTree.PatchDelegate
                ) => void;

                  method calculatePatch

                  calculatePatch: <K extends BaseEntry>(
                  theirFSTree: FSTree<K>,
                  isEqual?: (a: T, b: K) => boolean
                  ) => FSTree.Patch;

                    method defaultIsEqual

                    static defaultIsEqual: (entryA: DefaultEntry, entryB: DefaultEntry) => boolean;

                      method forEach

                      forEach: (
                      fn: (entry: T, index: number, collection: T[]) => void,
                      context: any
                      ) => void;

                        method fromEntries

                        static fromEntries: <T extends BaseEntry>(
                        entries: T[],
                        options?: FSTree.StaticOptions
                        ) => FSTree<T>;

                          method fromPaths

                          static fromPaths: (
                          paths: string[],
                          options?: FSTree.StaticOptions
                          ) => FSTree<Entry>;


                            interface Options

                            interface Options {}

                              property entries

                              entries?: BaseEntry[];

                                property sortAndExpand

                                sortAndExpand?: boolean;

                                  interface PatchDelegate

                                  interface PatchDelegate {}

                                    method change

                                    change: (inputPath: string, outputPath: string, relativePath: string) => void;

                                      method create

                                      create: (inputPath: string, outputPath: string, relativePath: string) => void;

                                        method mkdir

                                        mkdir: (inputPath: string, outputPath: string, relativePath: string) => void;

                                          method rmdir

                                          rmdir: (inputPath: string, outputPath: string, relativePath: string) => void;
                                            unlink: (inputPath: string, outputPath: string, relativePath: string) => void;

                                              interface StaticOptions

                                              interface StaticOptions {}

                                                property sortAndExpand

                                                sortAndExpand?: boolean;

                                                  Type Aliases

                                                  type Entry

                                                  type Entry = import('./entry').DefaultEntry;

                                                    type Operand

                                                    type Operand = 'unlink' | 'rmdir' | 'create' | 'change' | 'mkdir';

                                                      type Operation

                                                      type Operation = [Operand, string, DefaultEntry] | [Operand, string];

                                                        type Patch

                                                        type Patch = Operation[];

                                                          Package Files (1)

                                                          Dependencies (5)

                                                          Dev Dependencies (9)

                                                          Peer Dependencies (0)

                                                          No peer dependencies.


                                                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/fs-tree-diff.

                                                          • Markdown
                                                          • HTML
                                                            <a href="https://www.jsdocs.io/package/fs-tree-diff"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>