New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dir-stream

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dir-stream - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

56

index.js

@@ -1,31 +0,33 @@

var through = require('through'),
lsstream = require('ls-stream'),
path = require('path'),
ls = null
var path = require('path')
var lsstream = require('ls-stream')
, through = require('through')
module.exports = dirstream
function dirstream(options) {
var arr = [],
tr = through(write, noop)
function dirstream(_options) {
var stream = through(write, noop)
, ls = null
, arr = []
options = options || {}
options = _options || {}
return tr
return stream
function write(buf) {
arr.push(buf.toString().trim())
if (!ls) processDir(arr.shift())
arr.push(('' + buf).trim())
if(!ls) do_dir(arr.shift())
}
function processDir(dir) {
function do_dir(dir) {
ls = lsstream(dir)
ls.on('data', process_dir)
.on('end', next_dir)
.on('error', noop)
function process_dir(data) {
if (options.noRecurse) data.ignore()
if(options.noRecurse) data.ignore()
if (!data.stat ||
(options.ignoreExtensions &&
if(!data.stat || (options.ignoreExtensions &&
(options.ignoreExtensions.indexOf(

@@ -36,24 +38,20 @@ path.extname(data.path).slice(1)) !== -1)) ||

if (options.ignore) {
if (options.ignore.indexOf(data.path) !== -1 ||
if(options.ignore) {
if(options.ignore.indexOf(data.path) !== -1 ||
options.ignore.indexOf(path.dirname(data.path)) !== -1) return
var dirs = data.path.split(path.sep),
i = 0,
l = dirs.length
var dirs = data.path.split(path.sep)
for (; i < l; ++i) {
if (options.ignore.indexOf(dirs[i]) !== -1) return
for(var i = 0, l = dirs.length; i < l; ++i) {
if(options.ignore.indexOf(dirs[i]) !== -1) return
}
}
tr.queue(data.path)
stream.queue(data.path)
}
ls.on('end', function () {
if (!arr.length) return tr.queue(null)
processDir(arr.shift())
})
ls.on('error', noop)
function next_dir() {
if(!arr.length) return stream.queue(null)
do_dir(arr.shift())
}
}

@@ -60,0 +58,0 @@ }

{
"name": "dir-stream",
"version": "0.0.14",
"version": "0.0.15",
"description": "stream filenames",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc