Comparing version 2.6.1 to 2.6.2
{ | ||
"name": "ipfs-api", | ||
"version": "2.6.1", | ||
"version": "2.6.2", | ||
"description": "A client library for the IPFS API", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -5,2 +5,3 @@ 'use strict' | ||
const getFilesStream = require('./get-files-stream') | ||
const stream = require('stream') | ||
@@ -11,3 +12,3 @@ const isNode = !global.window | ||
function onEnd (buffer, result, cb) { | ||
function onEnd (buffer, result, passThrough, cb) { | ||
return (err, res, body) => { | ||
@@ -22,2 +23,9 @@ if (err) { | ||
if (result.stream) { | ||
cb(null, passThrough) | ||
passThrough.resume() | ||
passThrough.end() | ||
return | ||
} | ||
if ((result.stream && !buffer) || | ||
@@ -39,4 +47,8 @@ (result.chunkedObjects && buffer)) { | ||
function onData (result) { | ||
function onData (result, passThrough) { | ||
return chunk => { | ||
if (result.stream) { | ||
passThrough.write(chunk) | ||
return | ||
} | ||
if (!result.chunkedObjects) return | ||
@@ -70,4 +82,6 @@ | ||
return request(opts, onEnd(buffer, result, cb)) | ||
.on('data', onData(result)) | ||
var passThrough = new stream.PassThrough() | ||
return request(opts, onEnd(buffer, result, passThrough, cb)) | ||
.on('data', onData(result, passThrough)) | ||
.on('response', onResponse(result)) | ||
@@ -74,0 +88,0 @@ } |
@@ -155,3 +155,5 @@ /* global describe it before */ | ||
apiClients['a'].cat('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP', function (err, res) { | ||
if (err) throw err | ||
if (err) { | ||
throw err | ||
} | ||
@@ -158,0 +160,0 @@ if (typeof res === 'string') { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
51969
1406
0