mirror of
https://github.com/biobulkbende/biobulkbende.org.git
synced 2025-10-11 15:14:59 +00:00
structure, layout and automation
This commit is contained in:
25
node_modules/block-stream/LICENCE
generated
vendored
Normal file
25
node_modules/block-stream/LICENCE
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
Copyright (c) Isaac Z. Schlueter
|
||||
All rights reserved.
|
||||
|
||||
The BSD License
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
15
node_modules/block-stream/LICENSE
generated
vendored
Normal file
15
node_modules/block-stream/LICENSE
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
14
node_modules/block-stream/README.md
generated
vendored
Normal file
14
node_modules/block-stream/README.md
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
# block-stream
|
||||
|
||||
A stream of blocks.
|
||||
|
||||
Write data into it, and it'll output data in buffer blocks the size you
|
||||
specify, padding with zeroes if necessary.
|
||||
|
||||
```javascript
|
||||
var block = new BlockStream(512)
|
||||
fs.createReadStream("some-file").pipe(block)
|
||||
block.pipe(fs.createWriteStream("block-file"))
|
||||
```
|
||||
|
||||
When `.end()` or `.flush()` is called, it'll pad the block with zeroes.
|
209
node_modules/block-stream/block-stream.js
generated
vendored
Normal file
209
node_modules/block-stream/block-stream.js
generated
vendored
Normal file
@ -0,0 +1,209 @@
|
||||
// write data to it, and it'll emit data in 512 byte blocks.
|
||||
// if you .end() or .flush(), it'll emit whatever it's got,
|
||||
// padded with nulls to 512 bytes.
|
||||
|
||||
module.exports = BlockStream
|
||||
|
||||
var Stream = require("stream").Stream
|
||||
, inherits = require("inherits")
|
||||
, assert = require("assert").ok
|
||||
, debug = process.env.DEBUG ? console.error : function () {}
|
||||
|
||||
function BlockStream (size, opt) {
|
||||
this.writable = this.readable = true
|
||||
this._opt = opt || {}
|
||||
this._chunkSize = size || 512
|
||||
this._offset = 0
|
||||
this._buffer = []
|
||||
this._bufferLength = 0
|
||||
if (this._opt.nopad) this._zeroes = false
|
||||
else {
|
||||
this._zeroes = new Buffer(this._chunkSize)
|
||||
for (var i = 0; i < this._chunkSize; i ++) {
|
||||
this._zeroes[i] = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inherits(BlockStream, Stream)
|
||||
|
||||
BlockStream.prototype.write = function (c) {
|
||||
// debug(" BS write", c)
|
||||
if (this._ended) throw new Error("BlockStream: write after end")
|
||||
if (c && !Buffer.isBuffer(c)) c = new Buffer(c + "")
|
||||
if (c.length) {
|
||||
this._buffer.push(c)
|
||||
this._bufferLength += c.length
|
||||
}
|
||||
// debug("pushed onto buffer", this._bufferLength)
|
||||
if (this._bufferLength >= this._chunkSize) {
|
||||
if (this._paused) {
|
||||
// debug(" BS paused, return false, need drain")
|
||||
this._needDrain = true
|
||||
return false
|
||||
}
|
||||
this._emitChunk()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
BlockStream.prototype.pause = function () {
|
||||
// debug(" BS pausing")
|
||||
this._paused = true
|
||||
}
|
||||
|
||||
BlockStream.prototype.resume = function () {
|
||||
// debug(" BS resume")
|
||||
this._paused = false
|
||||
return this._emitChunk()
|
||||
}
|
||||
|
||||
BlockStream.prototype.end = function (chunk) {
|
||||
// debug("end", chunk)
|
||||
if (typeof chunk === "function") cb = chunk, chunk = null
|
||||
if (chunk) this.write(chunk)
|
||||
this._ended = true
|
||||
this.flush()
|
||||
}
|
||||
|
||||
BlockStream.prototype.flush = function () {
|
||||
this._emitChunk(true)
|
||||
}
|
||||
|
||||
BlockStream.prototype._emitChunk = function (flush) {
|
||||
// debug("emitChunk flush=%j emitting=%j paused=%j", flush, this._emitting, this._paused)
|
||||
|
||||
// emit a <chunkSize> chunk
|
||||
if (flush && this._zeroes) {
|
||||
// debug(" BS push zeroes", this._bufferLength)
|
||||
// push a chunk of zeroes
|
||||
var padBytes = (this._bufferLength % this._chunkSize)
|
||||
if (padBytes !== 0) padBytes = this._chunkSize - padBytes
|
||||
if (padBytes > 0) {
|
||||
// debug("padBytes", padBytes, this._zeroes.slice(0, padBytes))
|
||||
this._buffer.push(this._zeroes.slice(0, padBytes))
|
||||
this._bufferLength += padBytes
|
||||
// debug(this._buffer[this._buffer.length - 1].length, this._bufferLength)
|
||||
}
|
||||
}
|
||||
|
||||
if (this._emitting || this._paused) return
|
||||
this._emitting = true
|
||||
|
||||
// debug(" BS entering loops")
|
||||
var bufferIndex = 0
|
||||
while (this._bufferLength >= this._chunkSize &&
|
||||
(flush || !this._paused)) {
|
||||
// debug(" BS data emission loop", this._bufferLength)
|
||||
|
||||
var out
|
||||
, outOffset = 0
|
||||
, outHas = this._chunkSize
|
||||
|
||||
while (outHas > 0 && (flush || !this._paused) ) {
|
||||
// debug(" BS data inner emit loop", this._bufferLength)
|
||||
var cur = this._buffer[bufferIndex]
|
||||
, curHas = cur.length - this._offset
|
||||
// debug("cur=", cur)
|
||||
// debug("curHas=%j", curHas)
|
||||
// If it's not big enough to fill the whole thing, then we'll need
|
||||
// to copy multiple buffers into one. However, if it is big enough,
|
||||
// then just slice out the part we want, to save unnecessary copying.
|
||||
// Also, need to copy if we've already done some copying, since buffers
|
||||
// can't be joined like cons strings.
|
||||
if (out || curHas < outHas) {
|
||||
out = out || new Buffer(this._chunkSize)
|
||||
cur.copy(out, outOffset,
|
||||
this._offset, this._offset + Math.min(curHas, outHas))
|
||||
} else if (cur.length === outHas && this._offset === 0) {
|
||||
// shortcut -- cur is exactly long enough, and no offset.
|
||||
out = cur
|
||||
} else {
|
||||
// slice out the piece of cur that we need.
|
||||
out = cur.slice(this._offset, this._offset + outHas)
|
||||
}
|
||||
|
||||
if (curHas > outHas) {
|
||||
// means that the current buffer couldn't be completely output
|
||||
// update this._offset to reflect how much WAS written
|
||||
this._offset += outHas
|
||||
outHas = 0
|
||||
} else {
|
||||
// output the entire current chunk.
|
||||
// toss it away
|
||||
outHas -= curHas
|
||||
outOffset += curHas
|
||||
bufferIndex ++
|
||||
this._offset = 0
|
||||
}
|
||||
}
|
||||
|
||||
this._bufferLength -= this._chunkSize
|
||||
assert(out.length === this._chunkSize)
|
||||
// debug("emitting data", out)
|
||||
// debug(" BS emitting, paused=%j", this._paused, this._bufferLength)
|
||||
this.emit("data", out)
|
||||
out = null
|
||||
}
|
||||
// debug(" BS out of loops", this._bufferLength)
|
||||
|
||||
// whatever is left, it's not enough to fill up a block, or we're paused
|
||||
this._buffer = this._buffer.slice(bufferIndex)
|
||||
if (this._paused) {
|
||||
// debug(" BS paused, leaving", this._bufferLength)
|
||||
this._needsDrain = true
|
||||
this._emitting = false
|
||||
return
|
||||
}
|
||||
|
||||
// if flushing, and not using null-padding, then need to emit the last
|
||||
// chunk(s) sitting in the queue. We know that it's not enough to
|
||||
// fill up a whole block, because otherwise it would have been emitted
|
||||
// above, but there may be some offset.
|
||||
var l = this._buffer.length
|
||||
if (flush && !this._zeroes && l) {
|
||||
if (l === 1) {
|
||||
if (this._offset) {
|
||||
this.emit("data", this._buffer[0].slice(this._offset))
|
||||
} else {
|
||||
this.emit("data", this._buffer[0])
|
||||
}
|
||||
} else {
|
||||
var outHas = this._bufferLength
|
||||
, out = new Buffer(outHas)
|
||||
, outOffset = 0
|
||||
for (var i = 0; i < l; i ++) {
|
||||
var cur = this._buffer[i]
|
||||
, curHas = cur.length - this._offset
|
||||
cur.copy(out, outOffset, this._offset)
|
||||
this._offset = 0
|
||||
outOffset += curHas
|
||||
this._bufferLength -= curHas
|
||||
}
|
||||
this.emit("data", out)
|
||||
}
|
||||
// truncate
|
||||
this._buffer.length = 0
|
||||
this._bufferLength = 0
|
||||
this._offset = 0
|
||||
}
|
||||
|
||||
// now either drained or ended
|
||||
// debug("either draining, or ended", this._bufferLength, this._ended)
|
||||
// means that we've flushed out all that we can so far.
|
||||
if (this._needDrain) {
|
||||
// debug("emitting drain", this._bufferLength)
|
||||
this._needDrain = false
|
||||
this.emit("drain")
|
||||
}
|
||||
|
||||
if ((this._bufferLength === 0) && this._ended && !this._endEmitted) {
|
||||
// debug("emitting end", this._bufferLength)
|
||||
this._endEmitted = true
|
||||
this.emit("end")
|
||||
}
|
||||
|
||||
this._emitting = false
|
||||
|
||||
// debug(" BS no longer emitting", flush, this._paused, this._emitting, this._bufferLength, this._chunkSize)
|
||||
}
|
60
node_modules/block-stream/package.json
generated
vendored
Normal file
60
node_modules/block-stream/package.json
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
{
|
||||
"_from": "block-stream@*",
|
||||
"_id": "block-stream@0.0.9",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=",
|
||||
"_location": "/block-stream",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "block-stream@*",
|
||||
"name": "block-stream",
|
||||
"escapedName": "block-stream",
|
||||
"rawSpec": "*",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "*"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/tar"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz",
|
||||
"_shasum": "13ebfe778a03205cfe03751481ebb4b3300c126a",
|
||||
"_spec": "block-stream@*",
|
||||
"_where": "/home/outis/Documents/Sites/BBB/node_modules/tar",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/block-stream/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"inherits": "~2.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "a stream of blocks",
|
||||
"devDependencies": {
|
||||
"tap": "^5.7.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.4 || >=0.5.8"
|
||||
},
|
||||
"files": [
|
||||
"block-stream.js"
|
||||
],
|
||||
"homepage": "https://github.com/isaacs/block-stream#readme",
|
||||
"license": "ISC",
|
||||
"main": "block-stream.js",
|
||||
"name": "block-stream",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/block-stream.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --cov"
|
||||
},
|
||||
"version": "0.0.9"
|
||||
}
|
Reference in New Issue
Block a user