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

nodejs-file-downloader

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodejs-file-downloader - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

8

Downloader.js

@@ -138,8 +138,8 @@ const fs = require('fs');

// debugger;
// return this._saveFromBuffer(this.response.data);
return this._makeUntilSuccessful(async()=>{await this._saveFromBuffer(this.response.data)});
return this._saveFromBuffer(this.response.data);
// return this._makeUntilSuccessful(async()=>{await this._saveFromBuffer(this.response.data)});
}
// debugger;
// await this._saveFromReadableStream(this.response.data);
await this._makeUntilSuccessful(async()=>{await this._saveFromReadableStream(this.response.data)});
await this._saveFromReadableStream(this.response.data);
// await this._makeUntilSuccessful(async()=>{await this._saveFromReadableStream(this.response.data)});
}

@@ -146,0 +146,0 @@

@@ -363,5 +363,8 @@

// await verifyFile('./downloads/Koala.jpg', 29051);
} catch (error) {
debugger;
// debugger;
}finally{
await verifyFile('./downloads/Koala.jpg', 29051);
}

@@ -368,0 +371,0 @@

{
"name": "nodejs-file-downloader",
"version": "2.1.0",
"version": "2.1.1",
"description": "A file downloader for NodeJs",

@@ -5,0 +5,0 @@ "main": "Downloader.js",

@@ -1,2 +0,2 @@

nodejs-file-downloader is a simple utility for downloading files. It hides the complexity of dealing with streams, paths and duplicate file names. Can automatically repeat failed downloads.
nodejs-file-downloader is a simple utility for downloading files. It hides the complexity of dealing with streams, paths and duplicate file names. Can automatically repeat failed requests.

@@ -17,3 +17,3 @@ If you encounter any bugs or have a question, please don't hesitate to open an issue.

* [Get response and then download](#get-response-and-then-download)
* [Repeat failed downloads automatically](#repeat-failed-downloads-automatically)
* [Repeat failed requests automatically](#repeat-failed-requests-automatically)

@@ -129,7 +129,8 @@ ## Examples

#### Repeat failed downloads automatically
#### Repeat failed requests automatically
The program can repeat any failed http request or a stream automatically. Just set the maxAttempts property.
Note that this applies separately both to the http request and the stream(each will have 3 maxAttemps, in this example).
The program can repeat any failed http request automatically. Only if the provided config.maxAttempts number is exceeded, an Error is thrown.
Note that currently only the http requests will be repeated in case of an error, BUT NOT THE STREAM ITSELF. If a stream fails on its first attempt, an error is thrown as usual. I will change this behavior in the future.
```javascript

@@ -141,3 +142,3 @@

maxAttempts:3,//Default is 1.
onError:function(error){//You can also hook into each failed attempt.
onError:function(error){//You can also hook into each failed http request attempt.
console.log('Error from attempt ',error)

@@ -144,0 +145,0 @@ }

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