@nasriya/orchestriq
Version:
A package to generate Docker files
45 lines (44 loc) • 2.29 kB
TypeScript
import { Readable } from "stream";
import { RegistryAuth } from "../registries/docs";
declare class Helpers {
deepClone(value: any): any;
isURL(url: string): boolean;
/**
* Reads a response stream and logs its content in a human-readable format.
* It expects the response to be a JSON stream where each line is a JSON object.
* It parses each line and extracts the status, progress and error if present.
* If the verbose flag is set to true, it logs each line with status and progress.
* If the verbose flag is set to false, it logs only the final result.
*
* @param response - The response stream to read.
* @param verbose - Whether to log each line or just the final result.
*/
processStream(response: Response, verbose?: boolean): Promise<void>;
/**
* Converts a readable stream into a single buffer.
*
* @param stream - A readable stream, which can be either a Node.js Readable stream or a web ReadableStream.
* @returns A promise that resolves with a buffer containing all the data from the stream.
* @throws Will throw an error if the stream encounters an error during reading.
*
* This function listens for data, end, and error events on Node.js streams. For web streams, it uses an async iterator
* to read the stream. The resulting data chunks are collected into a buffer.
*/
streamToBuffer(stream: ReadableStream<any> | Readable | AsyncIterable<Uint8Array | string>): Promise<Buffer>;
addRegistryAuthHeader(reqOptions: Record<string, any>, auth: RegistryAuth, serveraddress?: string): void;
isValidObject(obj: any): boolean;
isObject(obj: any): boolean;
isNotEmptyObject(obj: any): boolean;
isValidEmail(email: string): boolean;
/**
* Checks if the given object has the specified property as its own property.
* This method does not check properties inherited through the prototype chain.
*
* @param obj - The object to check for the property.
* @param prop - The name of the property to check for.
* @returns A boolean indicating whether the object has the specified property as its own property.
*/
hasOwnProperty(obj: any, prop: string): boolean;
}
declare const helpers: Helpers;
export default helpers;