electron-builder-http
Advanced tools
Comparing version 18.5.0 to 18.5.1
@@ -219,2 +219,3 @@ declare module "electron-builder-http/out/CancellationToken" { | ||
import { RequestOptions } from "http" | ||
import { Transform } from "stream" | ||
import { CancellationToken } from "electron-builder-http/out/CancellationToken" | ||
@@ -282,2 +283,12 @@ import { ProgressInfo } from "electron-builder-http/out/ProgressCallbackTransform" | ||
export class DigestTransform extends Transform { | ||
private readonly expected | ||
private readonly algorithm | ||
private readonly encoding | ||
private readonly digester | ||
constructor(expected: string, algorithm: string, encoding: "hex" | "base64" | "latin1") | ||
_transform(chunk: any, encoding: string, callback: Function): void | ||
_flush(callback: Function): void | ||
} | ||
export function request<T>(options: RequestOptions, cancellationToken: CancellationToken, data?: { | ||
@@ -287,2 +298,4 @@ [name: string]: any | ||
export function safeGetHeader(response: any, headerKey: string): any | ||
export function configureRequestOptions(options: RequestOptions, token?: string | null, method?: "GET" | "DELETE" | "PUT"): RequestOptions | ||
@@ -289,0 +302,0 @@ |
@@ -6,5 +6,6 @@ "use strict"; | ||
}); | ||
exports.HttpExecutor = exports.HttpError = exports.executorHolder = exports.HttpExecutorHolder = undefined; | ||
exports.DigestTransform = exports.HttpExecutor = exports.HttpError = exports.executorHolder = exports.HttpExecutorHolder = undefined; | ||
exports.download = download; | ||
exports.request = request; | ||
exports.safeGetHeader = safeGetHeader; | ||
exports.configureRequestOptions = configureRequestOptions; | ||
@@ -191,2 +192,3 @@ exports.dumpRequestOptions = dumpRequestOptions; | ||
this.expected = expected; | ||
this.algorithm = algorithm; | ||
this.encoding = encoding; | ||
@@ -201,5 +203,6 @@ this.digester = (0, (_crypto || _load_crypto()).createHash)(algorithm); | ||
const hash = this.digester.digest(this.encoding); | ||
callback(hash === this.expected ? null : new Error(`SHA2 checksum mismatch, expected ${this.expected}, got ${hash}`)); | ||
callback(hash === this.expected ? null : new Error(`${this.algorithm} checksum mismatch, expected ${this.expected}, got ${hash}`)); | ||
} | ||
} | ||
exports.DigestTransform = DigestTransform; | ||
function request(options, cancellationToken, data) { | ||
@@ -206,0 +209,0 @@ return executorHolder.httpExecutor.request(options, cancellationToken, data); |
{ | ||
"name": "electron-builder-http", | ||
"version": "18.5.0", | ||
"version": "18.5.1", | ||
"main": "out/httpExecutor.js", | ||
@@ -5,0 +5,0 @@ "author": "Vladimir Krivosheev", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73815
806