Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ec04f6e

Browse files
hacdiasdaviddias
authored andcommitted
fix: exception when dir is empty (ipfs-inactive#680)
* fix: exception when dir is empty * Update ls.js
1 parent 12e23ee commit ec04f6e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/files/ls.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
const promisify = require('promisify-es6')
44

55
const transform = function (res, callback) {
6-
callback(null, res.Entries.map((entry) => {
6+
const entries = res.Entries || []
7+
8+
callback(null, entries.map((entry) => {
79
return {
810
name: entry.Name,
911
type: entry.Type,

0 commit comments

Comments
 (0)