Skip to content

Commit a6898ac

Browse files
achingbraingcohler
andauthored
fix: files ls should return string (#3352)
Supersedes #3345 #2939 Fixes #3330 #2948 BREAKING CHANGE: types returned by `ipfs.files.ls` are now strings, in line with the docs but different to previous behaviour Co-authored-by: Geoffrey Cohler <[email protected]>
1 parent a247b50 commit a6898ac

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/files/ls.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ module.exports = configure(api => {
4343
})
4444

4545
function toCoreInterface (entry) {
46-
if (entry.hash) entry.cid = new CID(entry.hash)
46+
if (entry.hash) {
47+
entry.cid = new CID(entry.hash)
48+
}
49+
4750
delete entry.hash
51+
52+
entry.type = entry.type === 1 ? 'directory' : 'file'
53+
4854
return entry
4955
}

0 commit comments

Comments
 (0)