{"name":"sb-scandir","version":"1.0.0","keywords":["scandir","steelbrain","files","scan"],"author":{"name":"steelbrain"},"license":"MIT","_id":"sb-scandir@1.0.0","maintainers":[{"name":"steelbrain","email":"i@steelbrain.me"}],"homepage":"https://github.com/steelbrain/scandir#readme","bugs":{"url":"https://github.com/steelbrain/scandir/issues"},"dist":{"shasum":"102b4666c7b644f4287f0d33ceb4374fac1bfa15","tarball":"http://registry-npm.ywwl.com/sb-scandir/download/sb-scandir-1.0.0.tgz","integrity":"sha512-0rKtb7W2BwMThDuF8p1ulU0reC8KHBGQEmHlEJ2NHWBRlFT4etj/1DZ8bGujqGIXoY4BztozLo8YSAdHT7Fd7A==","signatures":[{"sig":"MEQCIFKDnpD5zyRLJBWPpbq5isBPCkL6/rdwK4NnSZqBR1nQAiAowrIvT85F8In5i6ndd/2xRNPCj0OtSYecNZQgHT57dg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":3341,"noattachment":false,"key":"/sb-scandir/-/sb-scandir-1.0.0.tgz"},"main":"lib/index.js","_from":".","_shasum":"102b4666c7b644f4287f0d33ceb4374fac1bfa15","gitHead":"cb7a24293d5f0ebecbbc8d364829c283b8a8ce47","scripts":{"test":"(apm test) && (flow check | grep -q '0 errors') && (eslint . )","build":"npm run clean; babel src --out-dir lib","clean":"rm -rf lib","watch":"npm run clean; babel src --out-dir lib --watch"},"_npmUser":{"name":"steelbrain","email":"i@steelbrain.me"},"repository":{"url":"git+https://github.com/steelbrain/scandir.git","type":"git"},"_npmVersion":"3.10.3","description":"File scanning module for Node.js","directories":{},"_nodeVersion":"6.3.1","dependencies":{"sb-promisify":"^1.3.0"},"devDependencies":{"flow-bin":"^0.30.0","babel-cli":"^6.11.4","jasmine-fix":"^1.0.1","babel-preset-steelbrain":"^4.0.2","eslint-config-steelbrain":"^1.0.4"},"_npmOperationalInternal":{"tmp":"tmp/sb-scandir-1.0.0.tgz_1471818684600_0.959653042955324","host":"packages-12-west.internal.npmjs.com"},"readme":"# ScanDir\n\n`sb-scandir` is a node module that supports simple file scanning with some sugar features.\n\n## Installation\n\n```\nnpm install --save sb-scandir\n```\n\n## API\n\n```js\ninterface Result {\n  files: Array<string>\n  directories: Array<string>\n}\n\ninterface FileSystem {\n  join(pathA: string, pathB: string): string\n  basename(path: string): string\n  stat(path: string): Promise<fs.Stats>\n  readdir(path: string): Promise<string[]>\n}\n\ntype Validate = (path: string) => boolean\n\nexport const defaultFilesystem: FileSystem;\n\nexport default async function scanDirectory(\n  path: string,\n  {\n    recursive = true,\n    validate = null,\n    concurrency = Infinity,\n    fileSystem = defaultFilesystem,\n  }: {\n    recursive?: boolean\n    validate?: Validate | null\n    concurrency?: number\n    fileSystem?: Partial<FileSystem>\n  } = {},\n): Promise<Result>;\n```\n\n## Examples\n\n```js\nimport Path from 'path'\nimport scandir, { defaultFilesystem } from 'sb-scandir'\n// or\nconst { default: scandir, defaultFilesystem } = require('sb-scandir')\n\n// Scan all files except the dot ones\nscandir(__dirname).then(function(result) {\n  console.log('files', result.files)\n  console.log('directories', result.directories)\n})\n\n// Scan all top level files except dot ones\nscandir(__dirname, { recursive: false }).then(function(files) {\n  console.log('files', result.files)\n  console.log('directories', result.directories)\n})\n\n// Scan all files even the dot ones\nscandir(__dirname, { recursive: true, validate(path) {\n  return true\n}}).then(function(files) {\n  console.log('files', result.files)\n  console.log('directories', result.directories)\n})\n\n// Scan all files except in .git and node_modules\nscandir(__dirname, { recursive: true, validate(path) {\n  const baseName = Path.basename(path)\n  return baseName !== '.git' && baseName !== 'node_modules'\n}}).then(function(files) {\n  console.log('files', result.files)\n  console.log('directories', result.directories)\n})\n```\n\n## License\n\nThis project is licensed under the terms of MIT License. See the LICENSE file for more info.\n","publish_time":1471818686394,"_cnpm_publish_time":1471818686394,"dist-tags":{"latest":"3.1.1"}}