Comparing version 2.6.2 to 2.7.0
{ | ||
"name": "ipfs-api", | ||
"version": "2.6.2", | ||
"version": "2.7.0", | ||
"description": "A client library for the IPFS API", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -136,3 +136,6 @@ var multiaddr = require('multiaddr') | ||
stat: argCommand('object/stat'), | ||
links: argCommand('object/links') | ||
links: argCommand('object/links'), | ||
patch: function (file, opts, cb) { | ||
return requestAPI('object/patch', [file].concat(opts), null, null, cb) | ||
} | ||
} | ||
@@ -139,0 +142,0 @@ |
@@ -369,6 +369,6 @@ /* global describe it before */ | ||
describe('.object', function () { | ||
var testObject = | ||
Buffer(JSON.stringify({Data: 'testdata', Links: []})) | ||
var testObjectHash = | ||
'QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD' | ||
var testObject = Buffer(JSON.stringify({Data: 'testdata', Links: []})) | ||
var testObjectHash = 'QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD' | ||
var testPatchObject = Buffer(JSON.stringify({Data: 'new test data'})) | ||
var testPatchObjectHash = 'QmWJDtdQWQSajQPx1UVAGWKaSGrHVWdjnrNhbooHP7LuF2' | ||
@@ -452,2 +452,35 @@ it('object.put', function (done) { | ||
}) | ||
it('object.patch', function (done) { | ||
this.timeout(10000) | ||
apiClients['a'].object.put(testPatchObject, 'json', function (err, res) { | ||
if (err) { | ||
throw err | ||
} | ||
apiClients['a'].object.patch(testObjectHash, ['add-link', 'next', testPatchObjectHash], function (err, res) { | ||
if (err) { | ||
throw err | ||
} | ||
var o = JSON.parse(res) | ||
assert.deepEqual(o, { | ||
Hash: 'QmZFdJ3CQsY4kkyQtjoUo8oAzsEs5BNguxBhp8sjQMpgkd', | ||
Links: null | ||
}) | ||
apiClients['a'].object.get(o.Hash, function (err, res) { | ||
if (err) { | ||
throw err | ||
} | ||
assert.deepEqual(JSON.parse(res), { | ||
Data: 'testdata', | ||
Links: [{ | ||
Name: 'next', | ||
Hash: 'QmWJDtdQWQSajQPx1UVAGWKaSGrHVWdjnrNhbooHP7LuF2', | ||
Size: 15 | ||
}] | ||
}) | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) | ||
@@ -454,0 +487,0 @@ |
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
53228
1441