REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 4.40 KB
Close
/proc/thread-self/root/opt/alt/alt-nodejs11/root/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js
Text
Base64
// It is expected that, when .add() returns false, the consumer // of the DirWriter will pause until a "drain" event occurs. Note // that this is *almost always going to be the case*, unless the // thing being written is some sort of unsupported type, and thus // skipped over. module.exports = DirWriter var Writer = require('./writer.js') var inherits = require('inherits') var mkdir = require('mkdirp') var path = require('path') var collect = require('./collect.js') inherits(DirWriter, Writer) function DirWriter (props) { var self = this if (!(self instanceof DirWriter)) { self.error('DirWriter must be called as constructor.', null, true) } // should already be established as a Directory type if (props.type !== 'Directory' || !props.Directory) { self.error('Non-directory type ' + props.type + ' ' + JSON.stringify(props), null, true) } Writer.call(this, props) } DirWriter.prototype._create = function () { var self = this mkdir(self._path, Writer.dirmode, function (er) { if (er) return self.error(er) // ready to start getting entries! self.ready = true self.emit('ready') self._process() }) } // a DirWriter has an add(entry) method, but its .write() doesn't // do anything. Why a no-op rather than a throw? Because this // leaves open the door for writing directory metadata for // gnu/solaris style dumpdirs. DirWriter.prototype.write = function () { return true } DirWriter.prototype.end = function () { this._ended = true this._process() } DirWriter.prototype.add = function (entry) { var self = this // console.error('\tadd', entry._path, '->', self._path) collect(entry) if (!self.ready || self._currentEntry) { self._buffer.push(entry) return false } // create a new writer, and pipe the incoming entry into it. if (self._ended) { return self.error('add after end') } self._buffer.push(entry) self._process() return this._buffer.length === 0 } DirWriter.prototype._process = function () { var self = this // console.error('DW Process p=%j', self._processing, self.basename) if (self._processing) return var entry = self._buffer.shift() if (!entry) { // console.error("DW Drain") self.emit('drain') if (self._ended) self._finish() return } self._processing = true // console.error("DW Entry", entry._path) self.emit('entry', entry) // ok, add this entry // // don't allow recursive copying var p = entry var pp do { pp = p._path || p.path if (pp === self.root._path || pp === self._path || (pp && pp.indexOf(self._path) === 0)) { // console.error('DW Exit (recursive)', entry.basename, self._path) self._processing = false if (entry._collected) entry.pipe() return self._process() } p = p.parent } while (p) // console.error("DW not recursive") // chop off the entry's root dir, replace with ours var props = { parent: self, root: self.root || self, type: entry.type, depth: self.depth + 1 } pp = entry._path || entry.path || entry.props.path if (entry.parent) { pp = pp.substr(entry.parent._path.length + 1) } // get rid of any ../../ shenanigans props.path = path.join(self.path, path.join('/', pp)) // if i have a filter, the child should inherit it. props.filter = self.filter // all the rest of the stuff, copy over from the source. Object.keys(entry.props).forEach(function (k) { if (!props.hasOwnProperty(k)) { props[k] = entry.props[k] } }) // not sure at this point what kind of writer this is. var child = self._currentChild = new Writer(props) child.on('ready', function () { // console.error("DW Child Ready", child.type, child._path) // console.error(" resuming", entry._path) entry.pipe(child) entry.resume() }) // XXX Make this work in node. // Long filenames should not break stuff. child.on('error', function (er) { if (child._swallowErrors) { self.warn(er) child.emit('end') child.emit('close') } else { self.emit('error', er) } }) // we fire _end internally *after* end, so that we don't move on // until any "end" listeners have had their chance to do stuff. child.on('close', onend) var ended = false function onend () { if (ended) return ended = true // console.error("* DW Child end", child.basename) self._currentChild = null self._processing = false self._process() } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 14
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
abstract.js
1.98 KB
lrw-r--r--
2021-10-19 09:47:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
collect.js
1.75 KB
lrw-r--r--
2021-10-19 09:47:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
dir-reader.js
6.35 KB
lrw-r--r--
2021-10-19 09:47:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
dir-writer.js
4.40 KB
lrw-r--r--
2021-10-19 09:47:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
file-reader.js
3.89 KB
lrw-r--r--
2021-10-19 09:47:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
file-writer.js
2.53 KB
lrw-r--r--
2021-10-19 09:47:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
get-type.js
610 B
lrw-r--r--
2021-10-19 09:47:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
link-reader.js
1.47 KB
lrw-r--r--
2021-10-19 09:47:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
link-writer.js
2.78 KB
lrw-r--r--
2021-10-19 09:47:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
proxy-reader.js
1.96 KB
lrw-r--r--
2021-10-19 09:47:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
proxy-writer.js
2.39 KB
lrw-r--r--
2021-10-19 09:47:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
reader.js
6.92 KB
lrw-r--r--
2021-10-19 09:47:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
socket-reader.js
915 B
lrw-r--r--
2021-10-19 09:47:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
writer.js
10.74 KB
lrw-r--r--
2021-10-19 09:47:47
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).