Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
sb-scandir
Advanced tools
Changelog
3.1.0
Readme
sb-scandir
is a node module that supports simple file scanning with some sugar features.
npm install --save sb-scandir
interface Result {
files: Array<string>
directories: Array<string>
}
interface FileSystem {
join(pathA: string, pathB: string): string
basename(path: string): string
stat(path: string): Promise<fs.Stats>
readdir(path: string): Promise<string[]>
}
type Validate = (path: string) => boolean
export const defaultFilesystem: FileSystem;
export default async function scanDirectory(
path: string,
{
recursive = true,
validate = null,
concurrency = Infinity,
fileSystem = defaultFilesystem,
}: {
recursive?: boolean
validate?: Validate | null
concurrency?: number
fileSystem?: Partial<FileSystem>
} = {},
): Promise<Result>;
import Path from 'path'
import scandir, { defaultFilesystem } from 'sb-scandir'
// or
const { default: scandir, defaultFilesystem } = require('sb-scandir')
// Scan all files except the dot ones
scandir(__dirname).then(function(result) {
console.log('files', result.files)
console.log('directories', result.directories)
})
// Scan all top level files except dot ones
scandir(__dirname, { recursive: false }).then(function(files) {
console.log('files', result.files)
console.log('directories', result.directories)
})
// Scan all files even the dot ones
scandir(__dirname, { recursive: true, validate(path) {
return true
}}).then(function(files) {
console.log('files', result.files)
console.log('directories', result.directories)
})
// Scan all files except in .git and node_modules
scandir(__dirname, { recursive: true, validate(path) {
const baseName = Path.basename(path)
return baseName !== '.git' && baseName !== 'node_modules'
}}).then(function(files) {
console.log('files', result.files)
console.log('directories', result.directories)
})
This project is licensed under the terms of MIT License. See the LICENSE file for more info.
FAQs
File scanning module for Node.js
The npm package sb-scandir receives a total of 87,352 weekly downloads. As such, sb-scandir popularity was classified as popular.
We found that sb-scandir demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.