You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
579 B

4 years ago
  1. 'use strict';
  2. module.exports = readdirStream;
  3. const DirectoryReader = require('../directory-reader');
  4. let streamFacade = {
  5. fs: require('fs'),
  6. forEach: require('../async/for-each'),
  7. async: true
  8. };
  9. /**
  10. * Returns the {@link stream.Readable} of an asynchronous {@link DirectoryReader}.
  11. *
  12. * @param {string} dir
  13. * @param {object} [options]
  14. * @param {object} internalOptions
  15. */
  16. function readdirStream (dir, options, internalOptions) {
  17. internalOptions.facade = streamFacade;
  18. let reader = new DirectoryReader(dir, options, internalOptions);
  19. return reader.stream;
  20. }