Options
All
  • Public
  • Public/Protected
  • All
Menu

External module @twilio-labs/serverless-api/dist/utils/fs

Index

Type aliases

SearchConfig

SearchConfig: object

Type declaration

Variables

Const access

access: __promisify__ = promisify(fs.access)

Const readDir

readDir: function = promisify(recursiveReadDir)

Type declaration

    • (arg1: T1): Promise<TResult>
    • Parameters

      • arg1: T1

      Returns Promise<TResult>

Const readFile

readFile: __promisify__ = promisify(fs.readFile)

Const stat

stat: __promisify__ = promisify(fs.stat)

Const writeFile

writeFile: __promisify__ = promisify(fs.writeFile)

Functions

fileExists

  • fileExists(filePath: string): Promise<boolean>
  • Checks if a given file exists by checking if we have read & write access

    export

    Parameters

    • filePath: string

      full path of the file to check

    Returns Promise<boolean>

getDirContent

  • getDirContent(dir: string, extension?: undefined | string): Promise<FileInfo[]>
  • Retrieves all (nested) files from a given directory.

    If an extension is specified it will be used to filter the results.

    export

    Parameters

    • dir: string

      the directory to be checked

    • Optional extension: undefined | string

    Returns Promise<FileInfo[]>

getFirstMatchingDirectory

  • getFirstMatchingDirectory(basePath: string, directories: string[]): string
  • Given a list of directory names it will return the first one that exists in the base path.

    Important: Performs synchronous file system reading

    export

    Parameters

    • basePath: string
    • directories: string[]

    Returns string

getListOfFunctionsAndAssets

  • Retrieves a list of functions and assets existing in a given base directory Will check for both "functions" and "src" as directory for functions and "assets" and "static" for assets

    export

    Parameters

    • cwd: string

      Directory

    • Default value config: SearchConfig = {}

      lets you override the folders to use

    Returns Promise<DirectoryContent>

getPathAndAccessFromFileInfo

  • Determines the access and Serverless path for a filesystem resource. If it receives an ignore extension it will drop it from the final serverless path

    export

    Parameters

    • file: FileInfo

      the file to get the access and path for

    • Optional ignoreExtension: undefined | string

    Returns ResourcePathAndAccess

Generated using TypeDoc