@rxap/n8n-utilities
Version:
This package provides utility functions and classes for n8n nodes, including custom authentication methods (Bearer Auth, Oauth2 Proxy Auth, Base URL), a decorator for capturing execution errors, and base classes for creating nodes from OpenAPI specificati
18 lines (17 loc) • 1.29 kB
TypeScript
import { IBinaryData, IBinaryKeyData, INodeExecutionData } from 'n8n-workflow/dist/Interfaces';
import type { Readable } from 'stream';
/**
* Recursively adds files from a directory to the binary data of a result object.
* Traverses through the directory and its subdirectories, reading files
* and preparing their binary data to include in the provided result object.
*
* @param {string} dir - The directory path to process.
* @param {string} workDir - The base working directory, used to generate relative file paths.
* @param {INodeExecutionData & { binary: IBinaryKeyData }} result - The result object to which binary data of files will be added.
* @param {function} prepareBinaryData - A function that prepares binary data from a file's buffer, file path, and MIME type.
* It returns a Promise that resolves to a prepared IBinaryData object.
* @return {Promise<void>} A promise that resolves when all files in the directory and its subdirectories have been processed and their binary data added to the result.
*/
export declare function addFilesToResults(dir: string, workDir: string, result: INodeExecutionData & {
binary: IBinaryKeyData;
}, prepareBinaryData: (binaryData: Buffer | Readable, filePath?: string, mimeType?: string) => Promise<IBinaryData>): Promise<void>;