Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
The only file downloader you'll ever need. Node.js & Browser, CLI and library for fast and reliable file downloads.
Super fast file downloader with multiple connections
npx ipull http://example.com/file.large
import {downloadFile} from 'ipull';
const downloader = downloadFile('https://example.com/file.large', {
directory: './this/path',
cliProgress: true // Show progress bar in the CLI (default: true)
});
await downloader.download();
Download a file in the browser using multiple connections
import {downloadFileBrowserMemory} from "ipull/dist/browser.js";
const {downloader, memory} = await downloadFileBrowserMemory(DOWNLOAD_URL, {
acceptRangeAlwaysTrue: true // cors origin request will not return the range header, but we can force it to be true (multipart download)
});
await downloader.download();
image.src = memory.createBlobURL();
import {downloadFileBrowser} from "ipull/dist/browser.js";
const downloader = await downloadFileBrowser(DOWNLOAD_URL, {
onWrite: (cursor: number, buffer: Uint8Array, options) => {
console.log(`Writing ${buffer.length} bytes at cursor ${cursor}, with options: ${JSON.stringify(options)}`);
}
});
await downloader.download();
Usage: ipull [options] [files...]
Pull/copy files from remote server/local directory
Arguments:
files Files to pull/copy
Options:
-V, --version output the version number
-s --save [path] Save location (directory/file)
-f --full-name Show full name of the file while downloading, even if it long
-h, --help display help for command
Commands:
set [options] [path] <value> Set download locations
You can set a custom save directory by using the set
command.
ipull set .zip ~/Downloads/zips
(use default
to set the default save directory)
Download a file from multiple parts, and merge them into a single file.
Beneficial for downloading large files from servers that limit file size. (e.g. HuggingFace models)
import {downloadFile} from 'ipull';
const downloadParts = [
"https://example.com/file.large1",
"https://example.com/file.large2",
"https://example.com/file.large3",
];
const downloader = downloadFile(downloadParts, {
directory: './this/path',
filename: 'file.large'
});
await downloader.download();
** The split must be binary and not a zip-split
You can set custom headers for the download request
import {downloadFile} from 'ipull';
const downloader = downloadFile('https://example.com/file.large', {
directory: './this/path',
headers: {
'Authorization': 'Bearer token'
}
});
await downloader.download();
Copy file from local directory to another directory with CLI progress bar
import {copyFile} from 'ipull';
const downloader = await copyFile('path/to/file', {
directory: './this/path'
});
await downloader.download();
You can cancel the download by calling the abort
method
import {downloadFile} from 'ipull';
const downloader = downloadFile('https://example.com/file.large', {
directory: './this/path'
});
setTimeout(() => {
downloader.abort();
}, 5_000);
await downloader.download();
import {downloadFile} from 'ipull';
const downloader = downloadFile('https://example.com/file.large', {
directory: './this/path'
});
setInterval(() => {
downloader.pause();
setTimeout(() => {
downloader.resume();
}, 5_000);
}, 10_000);
await downloader.download();
** The pause may take a few seconds to actually pause the download, because it waits for the current connections to finish
If a network/file-system error occurs, the download will automatically retry with async-retry
import {downloadFile} from 'ipull';
const downloader = downloadFile('https://example.com/file.large', {
directory: './this/path'
});
try {
await downloader.download();
} catch (error) {
console.error(`Download failed: ${error.message}`);
}
In this example, there will be one progress bar for all the files
import {TransferCli, DownloadEngineNodejs, TransferStatistics} from "ipull";
const cli = new TransferCli();
const statistics = new TransferStatistics();
const filesToDownload = ["https://example.com/file1.large", "https://example.com/file2.large", "https://example.com/file3.large"];
let totalSize = 0;
let bytesDownloaded = 0;
const downloadsPromise = filesToDownload.map((url, index) => {
return DownloadEngineNodejs.fromParts(url, {
onInit(engine) {
totalSize += engine.file.totalSize;
},
onProgress(progress) {
const status = statistics.updateProgress(bytesDownloaded + progress.bytesDownloaded, totalSize);
cli.updateProgress({
...status,
...progress,
objectType: `${index}/${filesToDownload.length}`
});
},
onClosed(engine) {
bytesDownloaded += engine.file.totalSize
}
});
});
for (const downloader of await Promise.all(downloadsPromise)) {
await downloader.download();
}
If you like this repo, star it ✨
FAQs
The only file downloader you'll ever need. For node.js and the browser, CLI and library for fast and reliable file downloads.
The npm package ipull receives a total of 4,484 weekly downloads. As such, ipull popularity was classified as popular.
We found that ipull demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.