I'm trying to build a walk generator function for a ftp library I'm using on a personal project, however I'm getting an error that's stopping my progress.function* walk(ftp) { const top = currentWorkingDirectory(ftp); let list = currentList(ftp); let root = currentWorkingDirectory(ftp); let dirs = list.filter(o => o.type === 'd').map(o => o.name); let files = list.filter(o => o.type === '-').map(o => o.name); yield {root, dirs, files}; dirs.forEach(dir => { root = `${top}/${dir}`; ftp.cwd(root, () => { yield* walk(ftp); }); }); } On the line of yield* walk(ftp);, I'm getting an error of:A 'yield' expression is only allowed in a generator body.The thing is, I can't think of any other way to do what I need. Any help would be appreciated to solve this problem.Using this FTP library
Submitted July 09, 2018 at 10:02AM by Spedwards
No comments:
Post a Comment