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

klaw

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

klaw - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

4

CHANGELOG.md

@@ -0,1 +1,5 @@

1.1.2 / 2015-11-12
------------------
- assert that param `dir` is a `string`
1.1.1 / 2015-10-25

@@ -2,0 +6,0 @@ ------------------

23

index.js

@@ -0,1 +1,2 @@

var assert = require('assert')
var fs = require('fs')

@@ -8,2 +9,3 @@ var path = require('path')

function Walker (dir, options) {
assert.strictEqual(typeof dir, 'string', '`dir` parameter should be of type string. Got type: ' + typeof dir)
var defaultStreamOptions = { objectMode: true }

@@ -23,16 +25,17 @@ var defaultOpts = { queueMethod: 'shift', pathSorter: undefined }

var self = this
var item = this.paths[this.options.queueMethod]()
var pathItem = this.paths[this.options.queueMethod]()
fs.lstat(item, function (err, stats) {
if (err) return self.emit('error', err, { path: item, stats: stats })
if (!stats.isDirectory()) return self.push({ path: item, stats: stats })
fs.lstat(pathItem, function (err, stats) {
var item = { path: pathItem, stats: stats }
if (err) return self.emit('error', err, item)
if (!stats.isDirectory()) return self.push(item)
fs.readdir(item, function (err, items) {
if (err) return self.emit('error', err, { path: item, stats: stats })
fs.readdir(pathItem, function (err, pathItems) {
if (err) return self.emit('error', err, item)
items = items.map(function (part) { return path.join(item, part) })
if (self.options.pathSorter) items.sort(self.options.pathSorter)
items.forEach(function (item) { self.paths.push(item) })
pathItems = pathItems.map(function (part) { return path.join(pathItem, part) })
if (self.options.pathSorter) pathItems.sort(self.options.pathSorter)
pathItems.forEach(function (pi) { self.paths.push(pi) })
self.push({ path: item, stats: stats })
self.push(item)
})

@@ -39,0 +42,0 @@ })

{
"name": "klaw",
"version": "1.1.1",
"version": "1.1.2",
"description": "File system walker with Readable stream interface.",

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

@@ -156,3 +156,3 @@ Node.js - klaw

klaw('/some/dir')
.pipe(excludeDirFilter)
.pipe(aggregatePngSize)
.on('data', function (item) {

@@ -159,0 +159,0 @@ items.push(item.path)

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