Socket
Socket
Sign inDemoInstall

fstream

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fstream - npm Package Compare versions

Comparing version 0.1.15 to 0.1.16

35

lib/dir-reader.js

@@ -33,2 +33,6 @@ // A thing that emits "entry" events with Reader objects

if (props.sort) {
this.sort = props.sort
}
Reader.call(this, props)

@@ -39,2 +43,8 @@ }

var me = this
// race condition. might pause() before calling _getEntries,
// and then resume, and try to get them a second time.
if (me._gotEntries) return
me._gotEntries = true
fs.readdir(me._path, function (er, entries) {

@@ -51,5 +61,4 @@ if (er) return me.error(er)

me._length = me.entries.length
// console.error("DR %s sort =", me.path, me.props.sort)
if (typeof me.props.sort === "function") {
me.entries.sort(me.props.sort)
if (typeof me.sort === "function") {
me.entries = me.entries.sort(me.sort.bind(me))
}

@@ -73,3 +82,3 @@ me._read()

me._index ++
if (me._index >= me._length) {
if (me._index >= me.entries.length) {
if (!me._ended) {

@@ -96,4 +105,10 @@ me._ended = true

var who = me._proxy || me
stat.path = p
stat.basename = path.basename(p)
stat.dirname = path.dirname(p)
var childProps = me.getChildProps.call(who, stat)
childProps.path = p
childProps.basename = path.basename(p)
childProps.dirname = path.dirname(p)

@@ -143,4 +158,3 @@ var entry = Reader(childProps, stat)

} else {
me.emit("entry", entry)
me.emit("child", entry)
me.emitEntry(entry)
}

@@ -230,6 +244,9 @@ })

if (me._currentEntry) {
if (me._currentEntry.resume) {
me._currentEntry.resume(who)
}
if (me._currentEntry.resume) me._currentEntry.resume(who)
} else me._read()
}
DirReader.prototype.emitEntry = function (entry) {
this.emit("entry", entry)
this.emit("child", entry)
}

@@ -103,3 +103,5 @@ // It is expected that, when .add() returns false, the consumer

do {
if (p._path === me.root._path || p._path === me._path) {
var pp = p._path || p.path
if (pp === me.root._path || pp === me._path ||
(pp && pp.indexOf(me._path) === 0)) {
// console.error("DW Exit (recursive)", entry.basename, me._path)

@@ -106,0 +108,0 @@ me._processing = false

@@ -7,3 +7,2 @@

, inherits = require("inherits")
, collect = require("./collect.js")
, path = require("path")

@@ -10,0 +9,0 @@ , rimraf = require("rimraf")

@@ -5,3 +5,3 @@ {

"description": "Advanced file system stream things",
"version": "0.1.15",
"version": "0.1.16",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

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