forked from enviPath/enviPy
Current Dev State
This commit is contained in:
21
static/js/ketcher2/node_modules/bufferstreams/LICENCE
generated
vendored
Normal file
21
static/js/ketcher2/node_modules/bufferstreams/LICENCE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2013 Nicolas Froidure, <http://insertafter.com/>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
86
static/js/ketcher2/node_modules/bufferstreams/README.md
generated
vendored
Normal file
86
static/js/ketcher2/node_modules/bufferstreams/README.md
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
# BufferStreams
|
||||
|
||||
[](https://www.npmjs.com/package/bufferstreams)
|
||||
[](https://travis-ci.org/nfroidure/BufferStreams)
|
||||
[](https://david-dm.org/nfroidure/bufferstreams)
|
||||
[](https://david-dm.org/nfroidure/bufferstreams#info=devDependencies)
|
||||
[](https://coveralls.io/r/nfroidure/BufferStreams?branch=master)
|
||||
[](https://codeclimate.com/github/nfroidure/BufferStreams)
|
||||
|
||||
`bufferstreams` abstracts streams to allow you to deal with their whole content
|
||||
in a single buffer when it becomes necessary (by example: a legacy library that
|
||||
do not support streams).
|
||||
|
||||
It is not a good practice, just some glue. Using `bufferstreams` means:
|
||||
* there is no library dealing with streams for your needs
|
||||
* you filled an issue to the wrapped library to support streams
|
||||
|
||||
`bufferstreams` can also be used to control the whole stream content in a single
|
||||
point of a streaming pipeline for testing purposes.
|
||||
|
||||
## Usage
|
||||
Install the [npm module](https://npmjs.org/package/bufferstreams):
|
||||
```sh
|
||||
npm install bufferstreams --save
|
||||
```
|
||||
Then, in your scripts:
|
||||
```js
|
||||
var fs = require('fs');
|
||||
var bufferstreams = require('bufferstreams');
|
||||
|
||||
fs.createReadStream('input.txt')
|
||||
.pipe(new bufferstreams(function(err, buf, cb) {
|
||||
|
||||
// err will be filled with an error if the piped in stream emits one.
|
||||
if(err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
// buf will contain the whole piped in stream contents
|
||||
buf = Buffer(buf.toString('utf-8').replace('foo', 'bar'));
|
||||
|
||||
// cb is a callback to pass the result back to the piped out stream
|
||||
// first argument is an error that will be emitted if any
|
||||
// the second argument is the modified buffer
|
||||
cb(null, buf);
|
||||
|
||||
}))
|
||||
.pipe(fs.createWriteStream('output.txt'));
|
||||
```
|
||||
|
||||
Note that you can use `bufferstreams` with the objectMode option. In this case,
|
||||
the given buffer will be an array containing the streamed objects:
|
||||
```js
|
||||
new BufferStreams({objectMode: true}, myCallback);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### Stream : BufferStreams([options], callback)
|
||||
|
||||
#### options
|
||||
|
||||
##### options.objectMode
|
||||
Type: `Boolean`
|
||||
Default value: `false`
|
||||
|
||||
Use if piped in streams are in object mode. In this case, an array of the
|
||||
buffered will be transmitted to the `callback` function.
|
||||
|
||||
##### options.*
|
||||
|
||||
`bufferstreams` inherits of Stream.Duplex, the options are passed to the
|
||||
parent constructor so you can use it's options too.
|
||||
|
||||
##### callback(err, buf, cb)
|
||||
Type: `Function`, required.
|
||||
|
||||
A function to handle the buffered content.
|
||||
|
||||
## Stats
|
||||
|
||||
[](https://nodei.co/npm/bufferstreams/)
|
||||
[](https://nodei.co/npm/bufferstreams/)
|
||||
|
||||
## Contributing
|
||||
Feel free to pull your code if you agree with publishing it under the MIT license.
|
||||
82
static/js/ketcher2/node_modules/bufferstreams/package.json
generated
vendored
Normal file
82
static/js/ketcher2/node_modules/bufferstreams/package.json
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"_from": "bufferstreams@^1.1.1",
|
||||
"_id": "bufferstreams@1.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-AWE3MGCsWYjv+ZBYcxEU9uGV1R4=",
|
||||
"_location": "/bufferstreams",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "bufferstreams@^1.1.1",
|
||||
"name": "bufferstreams",
|
||||
"escapedName": "bufferstreams",
|
||||
"rawSpec": "^1.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gulp-eslint",
|
||||
"/gulp-svg2ttf",
|
||||
"/gulp-ttf2eot",
|
||||
"/gulp-ttf2woff",
|
||||
"/gulp-ttf2woff2",
|
||||
"/ttf2woff2"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/bufferstreams/-/bufferstreams-1.1.1.tgz",
|
||||
"_shasum": "0161373060ac5988eff99058731114f6e195d51e",
|
||||
"_spec": "bufferstreams@^1.1.1",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/gulp-eslint",
|
||||
"author": {
|
||||
"name": "Nicolas Froidure",
|
||||
"url": "http://www.insertafter.com/blog.html"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/nfroidure/BufferStreams/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"readable-stream": "^2.0.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Abstract streams to deal with the whole buffered contents.",
|
||||
"devDependencies": {
|
||||
"eslint": "^1.0.0",
|
||||
"istanbul": "^0.3.17",
|
||||
"istanbul-coveralls": "^1.0.3",
|
||||
"mocha": "^2.2.5",
|
||||
"mocha-lcov-reporter": "^0.0.2",
|
||||
"sf-lint": "^1.0.2",
|
||||
"streamtest": "^1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"homepage": "https://github.com/nfroidure/BufferStreams",
|
||||
"keywords": [
|
||||
"buffer",
|
||||
"streaming",
|
||||
"stream",
|
||||
"async",
|
||||
"abstract"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "src/index.js",
|
||||
"name": "bufferstreams",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/nfroidure/BufferStreams.git"
|
||||
},
|
||||
"scripts": {
|
||||
"cli": "env NPM_RUN_CLI=1",
|
||||
"cover": "istanbul cover --report html _mocha -- tests/*.mocha.js -t 5000",
|
||||
"coveralls": "istanbul cover _mocha --report lcovonly -- tests/*.mocha.js -t 5000 && istanbul-coveralls",
|
||||
"lint": "eslint **/*.s",
|
||||
"test": "mocha tests/*.mocha.js",
|
||||
"trinity": "npm-check-updates -u && npm install && npm test && git commit package.json -m \"Dependencies update\" && git push"
|
||||
},
|
||||
"version": "1.1.1"
|
||||
}
|
||||
98
static/js/ketcher2/node_modules/bufferstreams/src/index.js
generated
vendored
Normal file
98
static/js/ketcher2/node_modules/bufferstreams/src/index.js
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
'use strict';
|
||||
|
||||
var Duplex = require('readable-stream').Duplex;
|
||||
var util = require('util');
|
||||
|
||||
// Inherit of Duplex stream
|
||||
util.inherits(BufferStream, Duplex);
|
||||
|
||||
// Constructor
|
||||
function BufferStream(options, cb) {
|
||||
var _this = this;
|
||||
|
||||
// Ensure new were used
|
||||
if (!(this instanceof BufferStream)) {
|
||||
return new BufferStream(options, cb);
|
||||
}
|
||||
|
||||
// Cast args
|
||||
if(options instanceof Function) {
|
||||
cb = options;
|
||||
options = {};
|
||||
}
|
||||
options = options || {};
|
||||
if(!(cb instanceof Function)) {
|
||||
throw new Error('The given callback must be a function.');
|
||||
}
|
||||
this.__objectMode = options.objectMode;
|
||||
|
||||
// Parent constructor
|
||||
Duplex.call(this, options);
|
||||
|
||||
// Keep a reference to the callback
|
||||
this._cb = cb;
|
||||
|
||||
// Add a finished flag
|
||||
this._bufferStreamFinished = false;
|
||||
|
||||
// Internal buffer
|
||||
this._bufferStreamBuffer = [];
|
||||
|
||||
// Internal logic
|
||||
function _bufferStreamCallbackWrapper(err) {
|
||||
var buffer = options.objectMode ?
|
||||
_this._bufferStreamBuffer :
|
||||
Buffer.concat(_this._bufferStreamBuffer);
|
||||
|
||||
err = err || null;
|
||||
_this._cb(
|
||||
err,
|
||||
buffer,
|
||||
function(err2, buf) {
|
||||
setImmediate(function() {
|
||||
_this.removeListener('error', _bufferStreamError);
|
||||
if(err2) {
|
||||
_this.emit('error', err2);
|
||||
}
|
||||
_this._bufferStreamBuffer = options.objectMode ? buf || [] : [buf];
|
||||
_this._bufferStreamFinished = true;
|
||||
_this._read();
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function _bufferStreamError(err) {
|
||||
if(_this._bufferStreamFinished) {
|
||||
return;
|
||||
}
|
||||
_bufferStreamCallbackWrapper(err);
|
||||
}
|
||||
|
||||
this.once('finish', _bufferStreamCallbackWrapper);
|
||||
|
||||
this.on('error', _bufferStreamError);
|
||||
}
|
||||
|
||||
BufferStream.prototype._write = function _bufferStreamWrite(chunk, encoding, done) {
|
||||
this._bufferStreamBuffer.push(chunk);
|
||||
done();
|
||||
};
|
||||
|
||||
BufferStream.prototype._read = function _bufferStreamRead(n) {
|
||||
var _this = this;
|
||||
|
||||
if(_this._bufferStreamFinished) {
|
||||
while(_this._bufferStreamBuffer.length) {
|
||||
if(!_this.push(_this._bufferStreamBuffer.shift())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(0 === _this._bufferStreamBuffer.length) {
|
||||
_this.push(null);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports = BufferStream;
|
||||
Reference in New Issue
Block a user