Guest User

Untitled

a guest
Oct 12th, 2021
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const fs = require('fs');
  2. let filesObj = []
  3.  
  4. const filesForTg = (srcFolder) => {
  5.     fs.readdir(srcFolder, (err, files) => { //беру список файлов
  6.         files.forEach((file, i) => {
  7.             filesObj.push ({ type: 'document', media: `./img/${file}` })
  8.         })
  9.         console.log(filesObj) //выводит
  10.         return filesObj
  11.     })
  12. }
  13. console.log(filesForTg('../img')) //не выводит
Advertisement
Add Comment
Please, Sign In to add comment