Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions lib/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var Stream = require('stream').Stream
var inherits = require('inherits')
var path = require('path')
var getType = require('./get-type.js')
var hardLinks = Reader.hardLinks = {}
var Abstract = require('./abstract.js')

// Must do this *before* loading the child classes
Expand Down Expand Up @@ -155,25 +154,6 @@ Reader.prototype._stat = function (currentStat) {
self.size = props.size

var type = getType(props)
var handleHardlinks = props.hardlinks !== false

// special little thing for handling hardlinks.
if (handleHardlinks && type !== 'Directory' && props.nlink && props.nlink > 1) {
var k = props.dev + ':' + props.ino
// console.error("Reader has nlink", self._path, k)
if (hardLinks[k] === self._path || !hardLinks[k]) {
hardLinks[k] = self._path
} else {
// switch into hardlink mode.
type = self.type = self.props.type = 'Link'
self.Link = self.props.Link = true
self.linkpath = self.props.linkpath = hardLinks[k]
// console.error("Hardlink detected, switching mode", self._path, self.linkpath)
// Setting __proto__ would arguably be the "correct"
// approach here, but that just seems too wrong.
self._stat = self._read = LinkReader.prototype._read
}
}

if (self.type && self.type !== type) {
self.error('Unexpected type: ' + type)
Expand Down