Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fs = require('fs');
- let filesObj = []
- const filesForTg = (srcFolder) => {
- fs.readdir(srcFolder, (err, files) => { //беру список файлов
- files.forEach((file, i) => {
- filesObj.push ({ type: 'document', media: `./img/${file}` })
- })
- console.log(filesObj) //выводит
- return filesObj
- })
- }
- console.log(filesForTg('../img')) //не выводит
Advertisement
Add Comment
Please, Sign In to add comment