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

ipull

Package Overview
Dependencies
Maintainers
0
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipull - npm Package Compare versions

Comparing version 3.9.1 to 3.9.2

2

dist/download/download-engine/streams/download-engine-fetch-stream/download-engine-fetch-stream-fetch.d.ts

@@ -10,3 +10,3 @@ import BaseDownloadEngineFetchStream, { DownloadInfoResponse, FetchSubState, WriteCallback } from "./base-download-engine-fetch-stream.js";

protected fetchDownloadInfoWithoutRetryByMethod(url: string, method?: "HEAD" | "GET"): Promise<DownloadInfoResponse>;
protected fetchDownloadInfoWithoutRetryContentRange(url: string): Promise<number>;
protected fetchDownloadInfoWithoutRetryContentRange(url: string, response?: Response): Promise<number>;
chunkGenerator(callback: WriteCallback, getNextChunk: GetNextChunk): Promise<void>;

@@ -13,0 +13,0 @@ protected static convertHeadersToRecord(headers: Headers): {

@@ -70,4 +70,4 @@ import BaseDownloadEngineFetchStream, { MIN_LENGTH_FOR_MORE_INFO_REQUEST } from "./base-download-engine-fetch-stream.js";

let length = parseInt(response.headers.get("content-length")) || 0;
if (method != "GET" && response.headers.get("content-encoding") || browserCheck() && MIN_LENGTH_FOR_MORE_INFO_REQUEST < length) {
length = acceptRange ? await this.fetchDownloadInfoWithoutRetryContentRange(url) : 0;
if (response.headers.get("content-encoding") || browserCheck() && MIN_LENGTH_FOR_MORE_INFO_REQUEST < length) {
length = acceptRange ? await this.fetchDownloadInfoWithoutRetryContentRange(url, method === "GET" ? response : undefined) : 0;
}

@@ -81,4 +81,4 @@ return {

}
async fetchDownloadInfoWithoutRetryContentRange(url) {
const responseGet = await fetch(url, {
async fetchDownloadInfoWithoutRetryContentRange(url, response) {
const responseGet = response ?? await fetch(url, {
method: "GET",

@@ -85,0 +85,0 @@ headers: {

@@ -16,4 +16,4 @@ import BaseDownloadEngineFetchStream, { DownloadInfoResponse, FetchSubState, WriteCallback } from "./base-download-engine-fetch-stream.js";

protected fetchDownloadInfoWithoutRetryByMethod(url: string, method?: "HEAD" | "GET"): Promise<DownloadInfoResponse>;
protected fetchDownloadInfoWithoutRetryContentRange(url: string): Promise<number>;
protected fetchDownloadInfoWithoutRetryContentRange(url: string, xhrResponse?: XMLHttpRequest): number | Promise<number>;
protected static convertXHRHeadersToRecord(xhr: XMLHttpRequest): Record<string, string>;
}

@@ -132,3 +132,3 @@ import BaseDownloadEngineFetchStream, { MIN_LENGTH_FOR_MORE_INFO_REQUEST } from "./base-download-engine-fetch-stream.js";

const contentLength = parseInt(xhr.getResponseHeader("content-length"));
const length = MIN_LENGTH_FOR_MORE_INFO_REQUEST < contentLength && method != "GET" ? await this.fetchDownloadInfoWithoutRetryContentRange(url) : 0;
const length = MIN_LENGTH_FOR_MORE_INFO_REQUEST < contentLength ? await this.fetchDownloadInfoWithoutRetryContentRange(url, method === "GET" ? xhr : undefined) : 0;
const fileName = parseContentDisposition(xhr.getResponseHeader("content-disposition"));

@@ -153,3 +153,10 @@ const acceptRange = this.options.acceptRangeIsKnown ?? xhr.getResponseHeader("Accept-Ranges") === "bytes";

}
fetchDownloadInfoWithoutRetryContentRange(url) {
fetchDownloadInfoWithoutRetryContentRange(url, xhrResponse) {
const getSize = (xhr) => {
const contentRange = xhr.getResponseHeader("Content-Range");
return parseHttpContentRange(contentRange)?.size || 0;
};
if (xhrResponse) {
return getSize(xhrResponse);
}
return new Promise((resolve, reject) => {

@@ -167,4 +174,3 @@ const xhr = new XMLHttpRequest();

xhr.onload = () => {
const contentRange = xhr.getResponseHeader("Content-Range");
resolve(parseHttpContentRange(contentRange)?.size || 0);
resolve(getSize(xhr));
};

@@ -171,0 +177,0 @@ xhr.onerror = () => {

{
"name": "ipull",
"version": "3.9.1",
"version": "3.9.2",
"description": "The only file downloader you'll ever need. For node.js and the browser, CLI and library for fast and reliable file downloads.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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