You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

ipfs-utils

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.2.0 to 2.2.1

15

CHANGELOG.md

@@ -0,1 +1,16 @@

<a name="2.2.1"></a>
## [2.2.1](https://github.com/ipfs/js-ipfs-utils/compare/v2.2.0...v2.2.1) (2020-05-01)
### Bug Fixes
* make timeouts stricter ([#40](https://github.com/ipfs/js-ipfs-utils/issues/40)) ([bbcd1eb](https://github.com/ipfs/js-ipfs-utils/commit/bbcd1eb))
### Features
* pass in Options Object to http Constructor ([#37](https://github.com/ipfs/js-ipfs-utils/issues/37)) ([727f28d](https://github.com/ipfs/js-ipfs-utils/commit/727f28d))
<a name="2.2.0"></a>

@@ -2,0 +17,0 @@ # [2.2.0](https://github.com/ipfs/js-ipfs-utils/compare/v2.1.0...v2.2.0) (2020-04-14)

5

package.json
{
"name": "ipfs-utils",
"version": "2.2.0",
"version": "2.2.1",
"description": "Package to aggregate shared logic and dependencies for the IPFS ecosystem",

@@ -60,4 +60,5 @@ "main": "src/index.js",

"Marcin Rataj <lidel@lidel.org>",
"bluelovers <codelovers@users.sourceforge.net>"
"bluelovers <codelovers@users.sourceforge.net>",
"Hector Sanjuan <code@hector.link>"
]
}

3

src/files/url-source.js

@@ -6,5 +6,4 @@ 'use strict'

module.exports = async function * urlSource (url, options) {
options = options || {}
const http = new Http()
const response = await http.get(url)
const response = await http.get(url, options)

@@ -11,0 +10,0 @@ yield {

@@ -33,19 +33,25 @@ /* eslint-disable no-undef */

const start = Date.now()
return new Promise((resolve, reject) => {
const timeoutID = setTimeout(() => {
reject(new TimeoutError())
const after = (next) => {
return (res) => {
clearTimeout(timeoutID)
const time = Date.now() - start
abortController.abort()
}, ms)
if (time >= ms) {
abortController.abort()
reject(new TimeoutError())
return
}
if (next) {
next(res)
}
}
}
const timeoutID = setTimeout(after(), ms)
promise
.then((result) => {
clearTimeout(timeoutID)
resolve(result)
}, (err) => {
clearTimeout(timeoutID)
reject(err)
})
.then(after(resolve), after(reject))
})

@@ -142,4 +148,10 @@ }

const response = await timeout(fetch(url, opts), opts.timeout, this.abortController)
const response = await timeout(fetch(url, {
...opts,
// node-fetch implements it's own timeout in an addition to the spec so do not
// pass the timeout value on, otherwise there are two sources of timeout errors
timeout: undefined
}), opts.timeout, this.abortController)
if (!response.ok && opts.throwHttpErrors) {

@@ -146,0 +158,0 @@ if (opts.handleError) {

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc