Permalink
Cannot retrieve contributors at this time
70 lines (70 sloc)
4.39 KB
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/@actions/artifact/lib/internal/utils.d.ts
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference types="node" /> | |
import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http'; | |
import { HttpClient, HttpClientResponse } from '@actions/http-client'; | |
/** | |
* Returns a retry time in milliseconds that exponentially gets larger | |
* depending on the amount of retries that have been attempted | |
*/ | |
export declare function getExponentialRetryTimeInMilliseconds(retryCount: number): number; | |
/** | |
* Parses a env variable that is a number | |
*/ | |
export declare function parseEnvNumber(key: string): number | undefined; | |
/** | |
* Various utility functions to help with the necessary API calls | |
*/ | |
export declare function getApiVersion(): string; | |
export declare function isSuccessStatusCode(statusCode?: number): boolean; | |
export declare function isForbiddenStatusCode(statusCode?: number): boolean; | |
export declare function isRetryableStatusCode(statusCode: number | undefined): boolean; | |
export declare function isThrottledStatusCode(statusCode?: number): boolean; | |
/** | |
* Attempts to get the retry-after value from a set of http headers. The retry time | |
* is originally denoted in seconds, so if present, it is converted to milliseconds | |
* @param headers all the headers received when making an http call | |
*/ | |
export declare function tryGetRetryAfterValueTimeInMilliseconds(headers: IncomingHttpHeaders): number | undefined; | |
export declare function getContentRange(start: number, end: number, total: number): string; | |
/** | |
* Sets all the necessary headers when downloading an artifact | |
* @param {string} contentType the type of content being uploaded | |
* @param {boolean} isKeepAlive is the same connection being used to make multiple calls | |
* @param {boolean} acceptGzip can we accept a gzip encoded response | |
* @param {string} acceptType the type of content that we can accept | |
* @returns appropriate headers to make a specific http call during artifact download | |
*/ | |
export declare function getDownloadHeaders(contentType: string, isKeepAlive?: boolean, acceptGzip?: boolean): OutgoingHttpHeaders; | |
/** | |
* Sets all the necessary headers when uploading an artifact | |
* @param {string} contentType the type of content being uploaded | |
* @param {boolean} isKeepAlive is the same connection being used to make multiple calls | |
* @param {boolean} isGzip is the connection being used to upload GZip compressed content | |
* @param {number} uncompressedLength the original size of the content if something is being uploaded that has been compressed | |
* @param {number} contentLength the length of the content that is being uploaded | |
* @param {string} contentRange the range of the content that is being uploaded | |
* @returns appropriate headers to make a specific http call during artifact upload | |
*/ | |
export declare function getUploadHeaders(contentType: string, isKeepAlive?: boolean, isGzip?: boolean, uncompressedLength?: number, contentLength?: number, contentRange?: string, digest?: StreamDigest): OutgoingHttpHeaders; | |
export declare function createHttpClient(userAgent: string): HttpClient; | |
export declare function getArtifactUrl(): string; | |
/** | |
* Uh oh! Something might have gone wrong during either upload or download. The IHtttpClientResponse object contains information | |
* about the http call that was made by the actions http client. This information might be useful to display for diagnostic purposes, but | |
* this entire object is really big and most of the information is not really useful. This function takes the response object and displays only | |
* the information that we want. | |
* | |
* Certain information such as the TLSSocket and the Readable state are not really useful for diagnostic purposes so they can be avoided. | |
* Other information such as the headers, the response code and message might be useful, so this is displayed. | |
*/ | |
export declare function displayHttpDiagnostics(response: HttpClientResponse): void; | |
export declare function createDirectoriesForArtifact(directories: string[]): Promise<void>; | |
export declare function createEmptyFilesForArtifact(emptyFilesToCreate: string[]): Promise<void>; | |
export declare function getFileSize(filePath: string): Promise<number>; | |
export declare function rmFile(filePath: string): Promise<void>; | |
export declare function getProperRetention(retentionInput: number, retentionSetting: string | undefined): number; | |
export declare function sleep(milliseconds: number): Promise<void>; | |
export interface StreamDigest { | |
crc64: string; | |
md5: string; | |
} | |
export declare function digestForStream(stream: NodeJS.ReadableStream): Promise<StreamDigest>; |