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

refactor(files): call cat from files.cat like the interface defines it #72

Merged
merged 1 commit into from
Sep 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ module.exports = (common) => {
describe('.cat', () => {
it('with a base58 string encoded multihash', (done) => {
const hash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'
ipfs.cat(hash, (err, stream) => {
ipfs.files.cat(hash, (err, stream) => {
expect(err).to.not.exist
stream.pipe(bl((err, data) => {
expect(err).to.not.exist
Expand All @@ -220,7 +220,7 @@ module.exports = (common) => {

it('with a multihash', (done) => {
const mhBuf = new Buffer(bs58.decode('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'))
ipfs.cat(mhBuf, (err, stream) => {
ipfs.files.cat(mhBuf, (err, stream) => {
expect(err).to.not.exist
stream.pipe(bl((err, data) => {
expect(err).to.not.exist
Expand All @@ -232,7 +232,7 @@ module.exports = (common) => {

it('streams a large file', (done) => {
const hash = 'Qme79tX2bViL26vNjPsF3DP1R9rMKMvnPYJiKTTKPrXJjq'
ipfs.cat(hash, (err, stream) => {
ipfs.files.cat(hash, (err, stream) => {
expect(err).to.not.exist
stream.pipe(bl((err, data) => {
expect(err).to.not.exist
Expand Down Expand Up @@ -262,7 +262,7 @@ module.exports = (common) => {
it('with a base58 multihash encoded string', () => {
const hash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'

return ipfs.cat(hash)
return ipfs.files.cat(hash)
.then((stream) => {
stream.pipe(bl((err, data) => {
expect(err).to.not.exist
Expand All @@ -274,7 +274,7 @@ module.exports = (common) => {
it('errors on invalid key', () => {
const hash = 'somethingNotMultihash'

return ipfs.cat(hash)
return ipfs.files.cat(hash)
.catch((err) => {
expect(err).to.exist
const errString = err.toString()
Expand All @@ -289,7 +289,7 @@ module.exports = (common) => {

it('with a multihash', () => {
const hash = new Buffer(bs58.decode('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'))
return ipfs.cat(hash)
return ipfs.files.cat(hash)
.then((stream) => {
stream.pipe(bl((err, data) => {
expect(err).to.not.exist
Expand Down