Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 682fa33

Browse files
committed
Merge pull request #194 from ipfs/tests/options-object
add object.new and a test for it + notes to the readme
2 parents ee87a6d + 5f663f6 commit 682fa33

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ curl 'http://localhost:5001/api/v0/object/get?arg=QmYEqnfCZp7a39Gxrgyv3qRS4MoCTG
103103
```
104104
*Data is base64 encoded.*
105105

106+
- [examples](https://github.com/ipfs/js-ipfs-api/blob/master/test/api/object.spec.js)
107+
106108
##### pin
107109

108110

src/api/object.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ module.exports = send => {
1212
return send('object/put', encoding, null, file, cb)
1313
},
1414
data: argCommand(send, 'object/data'),
15-
stat: argCommand(send, 'object/stat'),
1615
links: argCommand(send, 'object/links'),
16+
stat: argCommand(send, 'object/stat'),
17+
new: argCommand(send, 'object/new'),
1718
patch (file, opts, cb) {
1819
return send('object/patch', [file].concat(opts), null, null, cb)
1920
}

test/api/object.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,15 @@ describe('.object', () => {
9090
})
9191
})
9292
})
93+
94+
it('object.new', done => {
95+
apiClients['a'].object.new('unixfs-dir', (err, res) => {
96+
expect(err).to.not.exist
97+
expect(res).to.deep.equal({
98+
Hash: 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn',
99+
Links: null
100+
})
101+
done()
102+
})
103+
})
93104
})

0 commit comments

Comments
 (0)