list-contents
Version:
Returns a list of paths to the subfolders and subfiles of the specified location.
1 lines • 3.05 kB
JavaScript
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){var r=n(1),i=n(2),o=n(3),u=n(4),c=n(5),s=function(e){return"[31m".concat(e,"[0m")};e.exports=function(e,t,n){var f=c(n,Function)?[String,[Object],Function]:c(t,Function)?[String,Function]:c(t,Object)?[String,Object,Function]:[String,[Object,Function],[Function,void 0]];o(arguments,f,(function(e){throw new TypeError(s(e.message))}));var l=i.resolve(e),a=c(t,Object)?t:{},d=c(t,Function)?t:n,p=c(a.depth,Number)?a.depth:null,h=c(a.exclude,String)?[a.exclude]:c(a.exclude,Array)?a.exclude:[],v={error:null,dirs:[],files:[],inaccessible:[],path:l};function x(){d(this)}function b(e,t){this.error=t,d(this)}function g(e,t){O(this.path,(function(n){return n.exists?n.exists&&n.file?t(new Error("The given path '".concat(l,"' leads to the file, while it should indicate the folder."))):n.exists&&n.dir?n.exists&&n.dir?e():void 0:t(new Error("Could not get the access to the given path '".concat(l,"'."))):t(new Error("The given path '".concat(l,"' does not exist or is inaccessible.")))}))}function y(e){h=h.map((function(e){return i.normalize(e)})),e()}function j(e,t,n,o,u){var c=this,s=void 0===o?"./":o,f=i.join(this.path,s),l=(void 0===u?0:u)+1;r.readdir(f,(function(r,o){if(r&&(c.inaccessible.push(s),e()),!r){var u=0;for(var f in(o=o.filter((function(e){var t=h.indexOf(i.join(s,e));return t>=0&&h.splice(t,1),!(t>=0)}))).length||e(),o)m.call(c,s,o[f],(function(e,r){if(e&&l!==p)return j.call(c,a,t,n,r,l);a()}),e)}function a(){++u===o.length&&e()}}))}function m(e,t,n){var r=this,o=i.resolve(this.path,e,t),u=i.join(e,t);O(o,(function(e){e.error&&r.inaccessible.push(u),e.file&&r.files.push(u),e.dir&&r.dirs.push(u),n(e.dir,u)}))}function O(e,t){r.stat(e,(function(e,n){var i={error:null,exists:!1,file:!1,dir:!1};if(e&&(i.error=e),!e){i.exists=null===e;var o=n instanceof r.Stats;i.file=o&&n.isFile(),i.dir=o&&n.isDirectory()}return t(i)}))}u([g,y,j],{context:v},x,b)}},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("typeof-arguments")},function(e,t){e.exports=require("move-on")},function(e,t){e.exports=require("of-type")}]);