1

Собственно, есть путь к папке, нужно узнать, сколько в ней файлов .jpg.

1 ответ 1

1

Как-то так:

var fs = require('fs');

var files = fs.readdirSync(/imgs');
var jpgs = files.filter(function(el, i) {
  return el.substring(el.length - 3) == 'jpg';
});

console.log(jpgs.length);

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.