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

easydl

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easydl - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

LICENSE

1

dist/helpers.d.ts
export declare function delay(ms: number): Promise<void>;
export declare function safeRun<T extends (...args: any) => any>(fn: T): void;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.delay = void 0;
exports.safeRun = exports.delay = void 0;
function delay(ms) {

@@ -20,1 +20,8 @@ return __awaiter(this, void 0, void 0, function* () {

exports.delay = delay;
function safeRun(fn) {
try {
fn();
}
catch (_a) { }
}
exports.safeRun = safeRun;

2

dist/index.d.ts

@@ -13,3 +13,3 @@ /// <reference types="node" />

*/
existBehavior?: "overwrite" | "new_file" | "ignore";
existBehavior?: "overwrite" | "new_file" | "ignore" | "error";
/** Whether `EasyDl` should follow HTTP redirection. */

@@ -16,0 +16,0 @@ followRedirect?: boolean;

@@ -149,2 +149,5 @@ "use strict";

}
else if (stats && this._opts.existBehavior === "error") {
throw new Error(`Destination ${this.savedFilePath} already exists.`);
}
else {

@@ -175,5 +178,5 @@ break;

return;
this.emit("build", { percentage: 0 });
const dest = fs.createWriteStream(this.savedFilePath);
try {
this.emit("build", { percentage: 0 });
const dest = fs.createWriteStream(this.savedFilePath);
for (let i = 0; i < this._totalChunks; i += 1) {

@@ -186,5 +189,8 @@ const fileName = `${this.savedFilePath}.$$${i}`;

dest.on("error", rej);
source.on("end", res);
source.on("end", () => {
dest.removeListener("error", rej);
res();
});
});
source.close();
source.destroy();
this.emit("build", {

@@ -198,3 +204,3 @@ percentage: 100 * (i / this._totalChunks),

}
dest.close();
dest.destroy();
this._done = true;

@@ -205,2 +211,3 @@ this.emit("end");

catch (err) {
helpers_1.safeRun(dest.destroy);
this.emit("error", err);

@@ -330,2 +337,3 @@ this.destroy();

.wait();
helpers_1.safeRun(dest.destroy);
if (this._destroyed)

@@ -332,0 +340,0 @@ return;

{
"name": "easydl",
"version": "1.0.3",
"version": "1.1.0",
"description": "Easily download a file and save it to local disk. It supports resuming previously downloaded files, multi-connection/parallel downloads, and retry on fail out of the box!",

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

# EasyDl
![Install via NPM](https://nodei.co/npm/easydl.png)
[![Install via NPM](https://nodei.co/npm/easydl.png)](https://www.npmjs.com/package/easydl)

@@ -275,2 +275,3 @@ Easily download a file and save it to a local disk. It supports resuming previously downloaded files, multi-connection/parallel downloads, and retry on failure out of the box!

- `overwrite` - overwrite the file. Proceed with caution.
- `error` - throws error.
- `ignore` - ignore and skip this download

@@ -277,0 +278,0 @@ - `followRedirect` - (Boolean) Whether `EasyDl` should follow HTTP redirection. Defaults to `true`

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