Function mapStructureOrdered

  • Iterate through every file child of a folder recursively, call a mapper function with each file's contents and write the returned value of the mapper to the files. Mapper functions are invoked one at a time; to run them all at once, use [[mapStructure]].

    Parameters

    • path: string

      folder path to iterate through

    • mapper: MapStructureFunction<string>

      mapping function to call on each file

    • readOptions: BufferEncoding | {
          encoding: BufferEncoding;
      }

      options to pass to [[readFile]]

    • Optional writeOptions: null | ObjectEncodingOptions & Abortable & {
          flag?: string;
          flush?: boolean;
          mode?: Mode;
      } | "ascii" | "utf8" | "utf-8" | "utf16le" | "utf-16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex"

      options to pass to [[writeFile]]

    Returns Promise<MapStructureResult[]>

    a [[Promise]] resolving to an array of all processed files

  • Parameters

    • path: string
    • mapper: MapStructureFunction<Buffer>
    • Optional readOptions: null | "buffer" | {
          encoding?: null | "buffer";
      }
    • Optional writeOptions: null | ObjectEncodingOptions & Abortable & {
          flag?: string;
          flush?: boolean;
          mode?: Mode;
      } | "ascii" | "utf8" | "utf-8" | "utf16le" | "utf-16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex"

    Returns Promise<MapStructureResult[]>

Generated using TypeDoc