{"name":"sb-scandir","version":"3.0.0","keywords":["scandir","steelbrain","files","scan"],"author":{"name":"steelbrain"},"license":"MIT","_id":"sb-scandir@3.0.0","maintainers":[{"name":"steelbrain","email":"i@steelbrain.me"}],"homepage":"https://github.com/steelbrain/scandir#readme","bugs":{"url":"https://github.com/steelbrain/scandir/issues"},"ava":{"files":["test/*-test.ts"],"require":["ts-node/register/transpile-only"],"extensions":["ts"]},"dist":{"shasum":"b2f462094f661f12a089f55139b8edbf5ce5b088","tarball":"http://registry-npm.ywwl.com/sb-scandir/download/sb-scandir-3.0.0.tgz","fileCount":7,"integrity":"sha512-QH1L5cxhRcXI440ShNCPkxQBkzAqWe4je0FoWvfOB1+LDtWYGCJrbn8jK41qBqGqccFw0Mg8OmhR6cHnr3/rfw==","signatures":[{"sig":"MEQCIHuEb9gUQaWUPETVtlVoz+z8MGoHXu3bOSjn9kDbAcyqAiBIbuHtDQ2OX9/Ia+bxvnHqjTJKQYqriZsg9rNStMB5UQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":17596,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJer0rSCRA9TVsSAnZWagAA4dIP/RQhuCDJzsSZ3ZgRWJVk\nxZ5MveyfnTp4/JwzB4x4p5tdfYZR2Rl3mprv7bcSDh6HThLnEi3f/ODOXcOh\nKYdTc8gBZVuOIe/TKQB1wD6KHn0JxJYb72yhddlOsuxUHZsesWq5sK1AMQgR\nbmctcV0c3uQif57g4SovFx9FxUQyzzutP1DrtRP6zakhNgCpXroIAKA1pasL\nfQxws7awaQzwfSpt8imrqhv99nWTH6UMJ1XTzci5UASOUNQbbXXQmWfhuEuT\nATNwCu37Y2q0jNIDM/9pdVs4du8GJVHB4Ff3D82hPESPN6Di6BMEH7LzZJy7\nmvyrvkFgJt5nrDp+gFFzlAIDXwGjJe5ruBUFeIl2xZjtGL2AGlg94zNeVvVF\nhYR9fzbGQd0g9fq15qCjUCrzgGZoNiY1WtXvv3t2q/butb2SA2dMpdjL8FY0\nKUJZ3JJRYLh6JNIc6fyLU+RwPpXs2LI1Hi4xYxLd4B6+qjKZ0L7UImh16qfw\nMvldwDPlxGVgJR4mlKjCMqMigQVieVt5ucXpiirmMMjPM9ikHouvv4OPghEv\ndVO758ZOl+W8VWws6OAqBzRxFhK4jsxhQ7glZZe6rewQiukyqHHG17kfQgNv\ncniQfFrWhjD3hjq8vxwaH+/7u/EN9FCeGs1BiWrcEueyJJAuUuxxG/2izNQG\nMdIG\r\n=dIgE\r\n-----END PGP SIGNATURE-----\r\n","size":5139,"noattachment":false,"key":"/sb-scandir/-/sb-scandir-3.0.0.tgz"},"main":"lib/cjs/index.js","module":"lib/esm/index.js","engines":{"node":">= 8"},"gitHead":"f83d78572ded695c218a51e2e5877b655f68155b","scripts":{"lint":"(tsc -p . --noEmit) && (eslint . --ext .ts) && (prettier --list-different src/*.ts)","test":"ava","prepare":"yarn build:clean ; yarn build:esm ; yarn build:cjs ; yarn build:typings","build:cjs":"tsc --module commonjs --target es5 --outDir lib/cjs","build:esm":"tsc --module es2015 --target es2018 --outDir lib/esm","build:clean":"rm -rf lib","build:typings":"tsc --declaration --outDir lib/typings --emitDeclarationOnly"},"typings":"lib/typings/index.d.ts","_npmUser":{"name":"steelbrain","email":"i@steelbrain.me"},"repository":{"url":"git+https://github.com/steelbrain/scandir.git","type":"git"},"_npmVersion":"6.14.4","description":"File scanning module for Node.js","directories":{},"_nodeVersion":"12.16.2","dependencies":{"sb-promise-queue":"^2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"ava":"^3.7.0","ts-node":"^8.8.2","typescript":"^3.8.3","eslint-config-steelbrain":"^9.0.1"},"_npmOperationalInternal":{"tmp":"tmp/sb-scandir_3.0.0_1588546258394_0.7572883903304541","host":"s3://npm-registry-packages"},"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":1588546258519,"_cnpm_publish_time":1588546258519,"dist-tags":{"latest":"3.1.1"}}