1 // just like the Entry class, but it buffers the contents
3 // XXX It would be good to set a maximum BufferEntry filesize,
4 // since it eats up memory. In normal operation,
5 // these are only for long filenames or link names, which are
8 module.exports = BufferEntry
10 var inherits = require("inherits")
11 , Entry = require("./entry.js")
13 function BufferEntry () {
14 Entry.apply(this, arguments)
15 this._buffer = new Buffer(this.props.size)
18 this.on("end", function () {
19 this.body = this._buffer.toString().slice(0, -1)
23 inherits(BufferEntry, Entry)
25 // collect the bytes as they come in.
26 BufferEntry.prototype.write = function (c) {
27 c.copy(this._buffer, this._offset)
28 this._offset += c.length
29 Entry.prototype.write.call(this, c)