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

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ipfs-inactive/interface-js-ipfs-core
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.33.2
Choose a base ref
...
head repository: ipfs-inactive/interface-js-ipfs-core
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.34.0
Choose a head ref
  • 4 commits
  • 3 files changed
  • 2 contributors

Commits on Nov 13, 2017

  1. files.ls (#167)

    pgte authored and daviddias committed Nov 13, 2017
    Copy the full SHA
    0a0f204 View commit details
  2. chore: fix linting

    daviddias committed Nov 13, 2017
    Copy the full SHA
    911f5ee View commit details
  3. chore: update contributors

    daviddias committed Nov 13, 2017
    Copy the full SHA
    6f39ab3 View commit details
  4. Copy the full SHA
    85bfde5 View commit details
Showing with 110 additions and 1 deletion.
  1. +5 −0 CHANGELOG.md
  2. +1 −1 package.json
  3. +104 −0 src/files.js
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<a name="0.34.0"></a>
# [0.34.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.33.2...v0.34.0) (2017-11-13)



<a name="0.33.2"></a>
## [0.33.2](https://github.com/ipfs/interface-ipfs-core/compare/v0.33.1...v0.33.2) (2017-11-09)

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "interface-ipfs-core",
"version": "0.33.2",
"version": "0.34.0",
"description": "A test suite and interface you can use to implement a IPFS core interface.",
"main": "src/index.js",
"scripts": {
104 changes: 104 additions & 0 deletions src/files.js
Original file line number Diff line number Diff line change
@@ -535,6 +535,58 @@ module.exports = (common) => {
})
})
})

describe('.ls', () => {
it('with a base58 encoded string', () => {
const hash = 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP'
return ipfs.files.ls(hash).then((stream) => {
return new Promise((resolve, reject) => {
stream.pipe(concat((files) => {
expect(files).to.be.length(6)
// remove content so that we can compare
files.forEach((file) => delete file.content)
expect(files).to.deep.equal([ { depth: 1,
name: 'alice.txt',
path: 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/alice.txt',
size: 11696,
hash: 'QmZyUEQVuRK3XV7L9Dk26pg6RVSgaYkiSTEdnT2kZZdwoi',
type: 'file' },
{ depth: 1,
name: 'empty-folder',
path: 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/empty-folder',
size: 4,
hash: 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn',
type: 'dir' },
{ depth: 1,
name: 'files',
path: 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/files',
size: 183,
hash: 'QmZ25UfTqXGz9RsEJFg7HUAuBcmfx5dQZDXQd2QEZ8Kj74',
type: 'dir' },
{ depth: 1,
name: 'holmes.txt',
path: 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/holmes.txt',
size: 582072,
hash: 'QmR4nFjTu18TyANgC65ArNWp5Yaab1gPzQ4D8zp7Kx3vhr',
type: 'file' },
{ depth: 1,
name: 'jungle.txt',
path: 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/jungle.txt',
size: 2305,
hash: 'QmT6orWioMiSqXXPGsUi71CKRRUmJ8YkuueV2DPV34E9y9',
type: 'file' },
{ depth: 1,
name: 'pp.txt',
path: 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/pp.txt',
size: 4551,
hash: 'QmVwdDCY4SPGVFnNCiZnX5CtzwWDn6kAM98JXzKxE3kCmn',
type: 'file' } ])
resolve()
}))
})
})
})
})
})

describe('promise API', () => {
@@ -630,6 +682,58 @@ module.exports = (common) => {
})
})
})

describe('.ls', () => {
it('with a base58 encoded string', () => {
const hash = 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP'
return ipfs.files.ls(hash).then((stream) => {
return new Promise((resolve, reject) => {
stream.pipe(concat((files) => {
expect(files).to.be.length(6)
// remove content so that we can compare
files.forEach((file) => delete file.content)
expect(files).to.deep.equal([ { depth: 1,
name: 'alice.txt',
path: 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/alice.txt',
size: 11696,
hash: 'QmZyUEQVuRK3XV7L9Dk26pg6RVSgaYkiSTEdnT2kZZdwoi',
type: 'file' },
{ depth: 1,
name: 'empty-folder',
path: 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/empty-folder',
size: 4,
hash: 'QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn',
type: 'dir' },
{ depth: 1,
name: 'files',
path: 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/files',
size: 183,
hash: 'QmZ25UfTqXGz9RsEJFg7HUAuBcmfx5dQZDXQd2QEZ8Kj74',
type: 'dir' },
{ depth: 1,
name: 'holmes.txt',
path: 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/holmes.txt',
size: 582072,
hash: 'QmR4nFjTu18TyANgC65ArNWp5Yaab1gPzQ4D8zp7Kx3vhr',
type: 'file' },
{ depth: 1,
name: 'jungle.txt',
path: 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/jungle.txt',
size: 2305,
hash: 'QmT6orWioMiSqXXPGsUi71CKRRUmJ8YkuueV2DPV34E9y9',
type: 'file' },
{ depth: 1,
name: 'pp.txt',
path: 'QmVvjDy7yF7hdnqE8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXP/pp.txt',
size: 4551,
hash: 'QmVwdDCY4SPGVFnNCiZnX5CtzwWDn6kAM98JXzKxE3kCmn',
type: 'file' } ])
resolve()
}))
})
})
})
})
})
})
}