UNPKG

@rae004/get-file-paths

Version:

A package to get all file paths in a given directory recursively.

28 lines 1.5 kB
import { GetFilePathsOptions } from '../main.interface'; /** * Returns a file path from a relative root within a full path * * e.g. a fullPath of /usr/src/app/src/forms/layouts/<relativeRoot>/public/index.html * *** would be returned as public/index.html with opts.removeLeadingSlash = true (Default) * *** or /public/index.html with opts.removeLeadingSlash = false * * If lastIndexOfRelativeRoot = true we use lastIndexOf method to locate the index of relativeRoot * * e.g. if our full path is /usr/<relativeRoot>/app/<relativeRoot>/forms/layouts/test-form-layout/public/index.html * *** with lastIndexOfRelativeRoot = true (Default), then it would return a result of <relativeRoot>/forms/layouts/test-form-layout/public/index.html * *** with lastIndexOfRelativeRoot = false we would get <relativeRoot>/app/<relativeRoot>/forms/layouts/test-form-layout/public/index.html * * @param fullPath * @param options */ export declare const getRelativePath: (fullPath: string, options: GetFilePathsOptions) => string; /** * Generator function to loop through directories and return full file paths. * Recursively calls itself if another directory is encountered. * * @param dir directory path to search. * @param excludes string array of directory or file names to exclude. */ export declare const getFilePathsGenerator: (dir: string, excludes?: string[]) => AsyncIterableIterator<string>; export declare const getFileName: (path: string) => string; //# sourceMappingURL=utilities.d.ts.map