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

ipfs-api

Package Overview
Dependencies
Maintainers
5
Versions
177
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-api - npm Package Compare versions

Comparing version 2.9.11 to 2.9.12

3

package.json
{
"name": "ipfs-api",
"version": "2.9.11",
"version": "2.9.12",
"description": "A client library for the IPFS API",

@@ -32,2 +32,3 @@ "main": "src/index.js",

"babel-runtime": "^5.8.34",
"chai": "^3.4.1",
"concurrently": "^1.0.0",

@@ -34,0 +35,0 @@ "eslint-config-standard": "^4.4.0",

@@ -40,3 +40,3 @@ IPFS API wrapper library in JavaScript

Make the [ipfsapi.min.js](/ipfsapi.min.js) available through your server and load it using a normal `<script>` tag, this will export the `ipfsAPI` constructor on the `window` object, such that:
Make the [ipfsapi.min.js](https://github.com/ipfs/js-ipfs-api/blob/master/dist/ipfsapi.min.js) available through your server and load it using a normal `<script>` tag, this will export the `ipfsAPI` constructor on the `window` object, such that:

@@ -43,0 +43,0 @@ ```

@@ -27,3 +27,4 @@ 'use strict'

} else {
cb(res)
let error = new Error('key was not found (type 6)')
cb(error)
}

@@ -30,0 +31,0 @@ })

@@ -37,7 +37,7 @@ 'use strict'

apiClients['a'].add(file, (err, res) => {
if (err) throw err
expect(err).to.not.exist
const added = res[0] != null ? res[0] : res
assert.equal(added.Hash, 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP')
assert.equal(added.Name, path.basename(testfilePath))
expect(added).to.have.property('Hash', 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP')
expect(added).to.have.property('Name', path.basename(testfilePath))
done()

@@ -50,7 +50,5 @@ })

apiClients['a'].add(buf, (err, res) => {
if (err) throw err
assert.equal(res.length, 1)
const added = res[0]
assert.equal(added.Hash, 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP')
expect(err).to.not.exist
expect(res).to.have.length(1)
expect(res[0]).to.have.property('Hash', 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP')
done()

@@ -66,7 +64,5 @@ })

apiClients['a'].add(testfileBig, (err, res) => {
if (err) throw err
assert.equal(res.length, 1)
const added = res[0]
assert.equal(added.Hash, 'Qme79tX2bViL26vNjPsF3DP1R9rMKMvnPYJiKTTKPrXJjq')
expect(err).to.not.exist
expect(res).to.have.length(1)
expect(res[0]).to.have.a.property('Hash', 'Qme79tX2bViL26vNjPsF3DP1R9rMKMvnPYJiKTTKPrXJjq')
done()

@@ -82,6 +78,6 @@ })

apiClients['a'].add(testfilePath, (err, res) => {
if (err) throw err
expect(err).to.not.exist
const added = res[0] != null ? res[0] : res
assert.equal(added.Hash, 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP')
expect(added).to.have.property('Hash', 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP')
done()

@@ -94,9 +90,9 @@ })

if (isNode) {
if (err) throw err
expect(err).to.not.exist
const added = res[res.length - 1]
assert.equal(added.Hash, 'QmSzLpCVbWnEm3XoTWnv6DT6Ju5BsVoLhzvxKXZeQ2cmdg')
expect(added).to.have.property('Hash', 'QmSzLpCVbWnEm3XoTWnv6DT6Ju5BsVoLhzvxKXZeQ2cmdg')
done()
} else {
assert.equal(err.message, 'Recursive uploads are not supported in the browser')
expect(err.message).to.be.equal('Recursive uploads are not supported in the browser')
done()

@@ -112,6 +108,6 @@ }

apiClients['a'].add(stream, (err, res) => {
if (err) throw err
expect(err).to.not.exist
const added = res[0] != null ? res[0] : res
assert.equal(added.Hash, 'QmNRCQWfgze6AbBCaT1rkrkV5tJ2aP4oTNPb5JZcXYywve')
expect(added).to.have.a.property('Hash', 'QmNRCQWfgze6AbBCaT1rkrkV5tJ2aP4oTNPb5JZcXYywve')
done()

@@ -124,6 +120,6 @@ })

apiClients['a'].add(url, (err, res) => {
if (err) throw err
expect(err).to.not.exist
const added = res[0] != null ? res[0] : res
assert.equal(added.Hash, 'QmZmHgEX9baxUn3qMjsEXQzG6DyNcrVnwieQQTrpDdrFvt')
expect(added).to.have.a.property('Hash', 'QmZmHgEX9baxUn3qMjsEXQzG6DyNcrVnwieQQTrpDdrFvt')
done()

@@ -130,0 +126,0 @@ })

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

apiClients['a'].block.put(blorb, (err, res) => {
if (err) throw err
const store = res.Key
assert.equal(store, 'QmPv52ekjS75L4JmHpXVeuJ5uX2ecSfSZo88NSyxwA3rAQ')
expect(err).to.not.exist
expect(res).to.have.a.property('Key', 'QmPv52ekjS75L4JmHpXVeuJ5uX2ecSfSZo88NSyxwA3rAQ')
done()

@@ -19,3 +18,3 @@ })

apiClients['a'].block.get(blorbKey, (err, res) => {
if (err) throw err
expect(err).to.not.exist

@@ -26,3 +25,3 @@ let buf = ''

.on('end', function () {
assert.equal(buf, 'blorb')
expect(buf).to.be.equal('blorb')
done()

@@ -29,0 +28,0 @@ })

@@ -18,5 +18,3 @@ 'use strict'

apiClients['a'].cat('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP', (err, res) => {
if (err) {
throw err
}
expect(err).to.not.exist

@@ -28,3 +26,3 @@ let buf = ''

.on('end', () => {
assert.equal(buf, testfile)
expect(buf).to.be.equal(testfile.toString())
done()

@@ -41,5 +39,3 @@ })

apiClients['a'].cat('Qme79tX2bViL26vNjPsF3DP1R9rMKMvnPYJiKTTKPrXJjq', (err, res) => {
if (err) {
throw err
}
expect(err).to.not.exist

@@ -50,4 +46,4 @@ testfileBig = require('fs').createReadStream(__dirname + '/../15mb.random', { bufferSize: 128 })

streamEqual(res, testfileBig, (err, equal) => {
if (err) throw err
assert(equal)
expect(err).to.not.exist
expect(equal).to.be.true
done()

@@ -54,0 +50,0 @@ })

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

apiClients['a'].commands((err, res) => {
if (err) {
throw err
}
assert(res)
expect(err).to.not.exist
expect(res).to.exist
done()

@@ -12,0 +10,0 @@ })

@@ -9,6 +9,6 @@ 'use strict'

apiClients['a'].config.set(confKey, confVal, (err, res) => {
if (err) throw err
expect(err).to.not.exist
apiClients['a'].config.get(confKey, (err, res) => {
if (err) throw err
assert.equal(res.Value, confVal)
expect(err).to.not.exist
expect(res).to.have.a.property('Value', confVal)
done()

@@ -21,7 +21,4 @@ })

apiClients['c'].config.show((err, res) => {
if (err) {
throw err
}
assert(res)
expect(err).to.not.exist
expect(res).to.exist
done()

@@ -37,7 +34,4 @@ })

apiClients['c'].config.replace(__dirname + '/../r-config.json', (err, res) => {
if (err) {
throw err
}
assert.equal(res, null)
expect(err).to.not.exist
expect(res).to.be.equal(null)
done()

@@ -44,0 +38,0 @@ })

@@ -7,3 +7,3 @@ 'use strict'

apiClients['a'].dht.get('non-existent', {timeout: '100ms'}, (err, value) => {
assert(err)
expect(err).to.be.an.instanceof(Error)
done()

@@ -15,9 +15,7 @@ })

apiClients['a'].dht.put('scope', 'interplanetary', (err, res) => {
if (err) {
throw err
}
expect(err).to.not.exist
assert.equal(typeof res, 'object')
expect(res).to.be.an('array')
return done()
done()

@@ -28,6 +26,4 @@ // non ipns or pk hashes fail to fetch, known bug

// console.log('->>', err, value)
// if (err) {
// throw err
// }
// assert.equal(value, 'interplanetary')
// expect(err).to.not.exist
// expect(value).to.be.equal('interplanetary')
// done()

@@ -40,8 +36,5 @@ // })

apiClients['a'].dht.findprovs('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP', (err, res) => {
if (err) {
throw err
}
expect(err).to.not.exist
assert.equal(typeof res, 'object')
assert(res)
expect(res).to.be.an('array')
done()

@@ -48,0 +41,0 @@ })

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

apiClients['a'].diag.net((err, res) => {
if (err) {
throw err
}
assert(res)
expect(err).to.not.exist
expect(res).to.exist
done()

@@ -17,8 +15,6 @@ })

apiClients['a'].diag.sys((err, res) => {
if (err) {
throw err
}
assert(res)
assert(res.memory)
assert(res.diskinfo)
expect(err).to.not.exist
expect(res).to.exist
expect(res).to.have.a.property('memory')
expect(res).to.have.a.property('diskinfo')
done()

@@ -25,0 +21,0 @@ })

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

apiClients['a'].id((err, res) => {
if (err) throw err
const id = res
assert(id.ID)
assert(id.PublicKey)
expect(err).to.not.exist
expect(res).to.have.a.property('ID')
expect(res).to.have.a.property('PublicKey')
done()

@@ -12,0 +11,0 @@ })

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

it('has the api object', () => {
assert(apiClients['a'])
assert(apiClients['a'].id)
expect(apiClients['a']).to.exist
expect(apiClients['a']).to.have.a.property('id')
})
})

@@ -6,8 +6,6 @@ 'use strict'

apiClients['a'].log.tail((err, res) => {
if (err) {
throw err
}
expect(err).to.not.exist
res.once('data', obj => {
assert(obj)
assert.equal(typeof obj, 'object')
expect(obj).to.be.an('object')
done()

@@ -14,0 +12,0 @@ })

@@ -8,7 +8,5 @@ 'use strict'

apiClients['a'].name.publish('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP', (err, res) => {
if (err) {
throw err
}
assert(res)
expect(err).to.not.exist
name = res
expect(name).to.exist
done()

@@ -20,8 +18,7 @@ })

apiClients['a'].name.resolve(name.Name, (err, res) => {
if (err) {
throw err
}
assert(res)
assert.deepEqual(res, { Path: '/ipfs/' + name.Value })
expect(err).to.not.exist
expect(res).to.exist
expect(res).to.be.eql({
Path: '/ipfs/' + name.Value
})
done()

@@ -28,0 +25,0 @@ })

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

apiClients['a'].object.put(testObject, 'json', (err, res) => {
if (err) throw err
const obj = res
assert.equal(obj.Hash, testObjectHash)
assert.equal(obj.Links.length, 0)
expect(err).to.not.exist
expect(res).to.have.a.property('Hash', testObjectHash)
expect(res.Links).to.be.empty
done()

@@ -22,8 +21,5 @@ })

apiClients['a'].object.get(testObjectHash, (err, res) => {
if (err) {
throw err
}
const obj = res
assert.equal(obj.Data, 'testdata')
assert.equal(obj.Links.length, 0)
expect(err).to.not.exist
expect(res).to.have.a.property('Data', 'testdata')
expect(res.Links).to.be.empty
done()

@@ -35,3 +31,3 @@ })

apiClients['a'].object.data(testObjectHash, (err, res) => {
if (err) throw err
expect(err).to.not.exist

@@ -43,3 +39,3 @@ let buf = ''

.on('end', () => {
assert.equal(buf, 'testdata')
expect(buf).to.equal('testdata')
done()

@@ -52,6 +48,4 @@ })

apiClients['a'].object.stat(testObjectHash, (err, res) => {
if (err) {
throw err
}
assert.deepEqual(res, {
expect(err).to.not.exist
expect(res).to.be.eql({
Hash: 'QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD',

@@ -70,7 +64,5 @@ NumLinks: 0,

apiClients['a'].object.links(testObjectHash, (err, res) => {
if (err) {
throw err
}
expect(err).to.not.exist
assert.deepEqual(res, {
expect(res).to.be.eql({
Hash: 'QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD',

@@ -85,11 +77,6 @@ Links: []

apiClients['a'].object.put(testPatchObject, 'json', (err, res) => {
if (err) {
throw err
}
expect(err).to.not.exist
apiClients['a'].object.patch(testObjectHash, ['add-link', 'next', testPatchObjectHash], (err, res) => {
if (err) {
throw err
}
assert.deepEqual(res, {
expect(err).to.not.exist
expect(res).to.be.eql({
Hash: 'QmZFdJ3CQsY4kkyQtjoUo8oAzsEs5BNguxBhp8sjQMpgkd',

@@ -99,6 +86,4 @@ Links: null

apiClients['a'].object.get(res.Hash, (err, res2) => {
if (err) {
throw err
}
assert.deepEqual(res2, {
expect(err).to.not.exist
expect(res2).to.be.eql({
Data: 'testdata',

@@ -105,0 +90,0 @@ Links: [{

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

apiClients['b'].pin.add('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP', {recursive: false}, (err, res) => {
if (err) {
throw err
}
assert.equal(res.Pinned[0], 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP')
expect(err).to.not.exist
expect(res.Pinned[0]).to.be.equal('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP')
done()

@@ -17,6 +15,4 @@ })

apiClients['b'].pin.list((err, res) => {
if (err) {
throw err
}
assert(res)
expect(err).to.not.exist
expect(res).to.exist
done()

@@ -28,12 +24,8 @@ })

apiClients['b'].pin.remove('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP', {recursive: false}, (err, res) => {
if (err) {
throw err
}
assert(res)
expect(err).to.not.exist
expect(res).to.exist
apiClients['b'].pin.list('direct', (err, res) => {
if (err) {
throw err
}
assert(res)
assert.equal(Object.keys(res.Keys).length, 0)
expect(err).to.not.exist
expect(res).to.exist
expect(res.Keys).to.be.empty
done()

@@ -40,0 +32,0 @@ })

@@ -11,13 +11,7 @@ 'use strict'

apiClients['b'].id((err, id) => {
if (err) {
throw err
}
expect(err).to.not.exist
apiClients['a'].ping(id.ID, (err, res) => {
if (err) {
throw err
}
assert(res)
assert(res.Success)
expect(err).to.not.exist
expect(res).to.have.a.property('Success')
done()

@@ -24,0 +18,0 @@ })

@@ -12,5 +12,3 @@ 'use strict'

apiClients['a'].refs(folder, {'format': '<src> <dst> <linkname>'}, (err, objs) => {
if (err) {
throw err
}
expect(err).to.not.exist

@@ -39,3 +37,3 @@ const result = [{

}]
assert.deepEqual(objs, result)
expect(objs).to.eql(result)

@@ -42,0 +40,0 @@ done()

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

apiClients['a'].swarm.peers((err, res) => {
if (err) {
throw err
}
expect(err).to.not.exist
assert(res.Strings.length >= 2)
expect(res.Strings).to.have.length.above(1)
done()

@@ -13,0 +11,0 @@ })

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

apiClients['a'].version((err, res) => {
if (err) {
throw err
}
assert(res)
assert(res.Version)
expect(err).to.not.exist
expect(res).to.have.a.property('Version')
console.log(' - running against version', res.Version)

@@ -13,0 +10,0 @@ done()

'use strict'
const ipfsAPI = require('../src/index.js')
const assert = require('assert')

@@ -12,7 +11,7 @@ describe('ipfsAPI constructor tests', () => {

function clientWorks (client, done) {
client.id((err, res) => {
if (err) throw err
const id = res
assert(id.ID)
assert(id.PublicKey)
client.id((err, id) => {
expect(err).to.not.exist
expect(id).to.have.a.property('ID')
expect(id).to.have.a.property('PublicKey')
done()

@@ -19,0 +18,0 @@ })

@@ -6,3 +6,3 @@ 'use strict'

global.assert = require('assert')
global.expect = require('chai').expect
global.apiClients = {} // a, b, c

@@ -9,0 +9,0 @@ global.isNode = !global.window

Sorry, the diff of this file is not supported yet

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