Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

electron-builder-http

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-builder-http - npm Package Compare versions

Comparing version 10.16.0 to 10.17.1

13

out/electron-builder-http.d.ts

@@ -43,3 +43,2 @@ declare module "electron-builder-http/out/publishOptions" {

import { Url } from "url"
import { Transform } from "stream"

@@ -85,10 +84,2 @@ export interface DownloadOptions {

}
export class DigestTransform extends Transform {
private expected
private readonly digester
constructor(expected: string)
_transform(chunk: any, encoding: string, callback: Function): void
_flush(callback: Function): void
}
export const executorHolder: HttpExecutorHolder

@@ -107,2 +98,6 @@

export function calculateDownloadProgress(total: number, start: number, transferred: number, chunk: any, callback: any): number
export function safeGetHeader(response: any, headerKey: string): any
export function configurePipes(options: DownloadOptions, response: any, destination: string, callback: (error: Error | null) => void): void
}

@@ -109,0 +104,0 @@

@@ -6,3 +6,3 @@ "use strict";

});
exports.executorHolder = exports.DigestTransform = exports.HttpError = exports.HttpExecutor = exports.maxRedirects = exports.HttpExecutorHolder = undefined;
exports.executorHolder = exports.HttpError = exports.HttpExecutor = exports.maxRedirects = exports.HttpExecutorHolder = undefined;
exports.download = download;

@@ -13,2 +13,4 @@ exports.githubRequest = githubRequest;

exports.calculateDownloadProgress = calculateDownloadProgress;
exports.safeGetHeader = safeGetHeader;
exports.configurePipes = configurePipes;

@@ -27,2 +29,8 @@ var _crypto;

var _fsExtraP;
function _load_fsExtraP() {
return _fsExtraP = require("fs-extra-p");
}
function download(url, destination, options) {

@@ -75,2 +83,15 @@ return executorHolder.httpExecutor.download(url, destination, options);

exports.HttpError = HttpError;
class ProgressCallbackTransform extends (_stream || _load_stream()).Transform {
constructor(onProgress, total) {
super();
this.onProgress = onProgress;
this.total = total;
this.start = Date.now();
this.transferred = 0;
}
_transform(chunk, encoding, callback) {
this.transferred = calculateDownloadProgress(this.total, this.start, this.transferred, chunk, this.onProgress);
callback(null, chunk);
}
}
class DigestTransform extends (_stream || _load_stream()).Transform {

@@ -91,3 +112,2 @@ constructor(expected) {

}
exports.DigestTransform = DigestTransform;
const executorHolder = exports.executorHolder = new HttpExecutorHolder();

@@ -131,2 +151,32 @@ function githubRequest(path, token) {

}
function safeGetHeader(response, headerKey) {
const value = response.headers[headerKey];
if (value == null) {
return null;
} else if (Array.isArray(value)) {
// electron API
return value.length === 0 ? null : value[value.length - 1];
} else {
return value;
}
}
function configurePipes(options, response, destination, callback) {
const streams = [];
if (options.onProgress != null) {
const contentLength = safeGetHeader(response, "content-length");
if (contentLength != null) {
streams.push(new ProgressCallbackTransform(options.onProgress, parseInt(contentLength, 10)));
}
}
if (options.sha2 != null) {
streams.push(new DigestTransform(options.sha2));
}
const fileOut = (0, (_fsExtraP || _load_fsExtraP()).createWriteStream)(destination);
streams.push(fileOut);
let lastStream = response;
for (const stream of streams) {
lastStream = lastStream.pipe(stream);
}
fileOut.on("finish", () => fileOut.close(callback));
}
//# sourceMappingURL=httpExecutor.js.map
{
"name": "electron-builder-http",
"version": "10.16.0",
"version": "10.17.1",
"main": "out/httpExecutor.js",

@@ -13,3 +13,6 @@ "author": "Vladimir Krivosheev",

],
"dependencies": {
"fs-extra-p": "^3.0.3"
},
"typings": "./out/electron-builder-http.d.ts"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc