UrgentcareCLI 0.1.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/UrgentCare/CLI.rb +1 -2
- data/lib/UrgentCare/Scraper.rb +65 -0
- data/lib/UrgentCare/version.rb +2 -2
- data/lib/UrgentCare.rb +1 -0
- metadata +3 -313
- data/.gitignore +0 -11
- data/.rspec +0 -3
- data/.travis.yml +0 -5
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -12
- data/Gemfile.lock +0 -84
- data/LICENSE.txt +0 -21
- data/Notes +0 -41
- data/README.md +0 -41
- data/Rakefile +0 -8
- data/UrgentCare.gemspec +0 -39
- data/background.jpg +0 -0
- data/data.txt +0 -4
- data/lib/Urgentcare/Scraper.rb +0 -78
- data/node_modules/.bin/rimraf +0 -1
- data/node_modules/.package-lock.json +0 -250
- data/node_modules/balanced-match/.github/FUNDING.yml +0 -2
- data/node_modules/balanced-match/LICENSE.md +0 -21
- data/node_modules/balanced-match/README.md +0 -97
- data/node_modules/balanced-match/index.js +0 -62
- data/node_modules/balanced-match/package.json +0 -48
- data/node_modules/brace-expansion/LICENSE +0 -21
- data/node_modules/brace-expansion/README.md +0 -129
- data/node_modules/brace-expansion/index.js +0 -201
- data/node_modules/brace-expansion/package.json +0 -47
- data/node_modules/concat-map/.travis.yml +0 -4
- data/node_modules/concat-map/LICENSE +0 -18
- data/node_modules/concat-map/README.markdown +0 -62
- data/node_modules/concat-map/example/map.js +0 -6
- data/node_modules/concat-map/index.js +0 -13
- data/node_modules/concat-map/package.json +0 -43
- data/node_modules/concat-map/test/map.js +0 -39
- data/node_modules/core-util-is/LICENSE +0 -19
- data/node_modules/core-util-is/README.md +0 -3
- data/node_modules/core-util-is/float.patch +0 -604
- data/node_modules/core-util-is/lib/util.js +0 -107
- data/node_modules/core-util-is/package.json +0 -32
- data/node_modules/core-util-is/test.js +0 -68
- data/node_modules/fs.realpath/LICENSE +0 -43
- data/node_modules/fs.realpath/README.md +0 -33
- data/node_modules/fs.realpath/index.js +0 -66
- data/node_modules/fs.realpath/old.js +0 -303
- data/node_modules/fs.realpath/package.json +0 -26
- data/node_modules/glob/LICENSE +0 -21
- data/node_modules/glob/README.md +0 -375
- data/node_modules/glob/changelog.md +0 -67
- data/node_modules/glob/common.js +0 -234
- data/node_modules/glob/glob.js +0 -788
- data/node_modules/glob/package.json +0 -51
- data/node_modules/glob/sync.js +0 -484
- data/node_modules/immediate/LICENSE.txt +0 -20
- data/node_modules/immediate/README.md +0 -93
- data/node_modules/immediate/dist/immediate.js +0 -75
- data/node_modules/immediate/dist/immediate.min.js +0 -1
- data/node_modules/immediate/lib/browser.js +0 -69
- data/node_modules/immediate/lib/index.js +0 -73
- data/node_modules/immediate/package.json +0 -42
- data/node_modules/inflight/LICENSE +0 -15
- data/node_modules/inflight/README.md +0 -37
- data/node_modules/inflight/inflight.js +0 -54
- data/node_modules/inflight/package.json +0 -29
- data/node_modules/inherits/LICENSE +0 -16
- data/node_modules/inherits/README.md +0 -42
- data/node_modules/inherits/inherits.js +0 -9
- data/node_modules/inherits/inherits_browser.js +0 -27
- data/node_modules/inherits/package.json +0 -29
- data/node_modules/isarray/.npmignore +0 -1
- data/node_modules/isarray/.travis.yml +0 -4
- data/node_modules/isarray/Makefile +0 -6
- data/node_modules/isarray/README.md +0 -60
- data/node_modules/isarray/component.json +0 -19
- data/node_modules/isarray/index.js +0 -5
- data/node_modules/isarray/package.json +0 -45
- data/node_modules/isarray/test.js +0 -20
- data/node_modules/jszip/.codeclimate.yml +0 -16
- data/node_modules/jszip/.editorconfig +0 -8
- data/node_modules/jszip/.jshintignore +0 -1
- data/node_modules/jszip/.jshintrc +0 -21
- data/node_modules/jszip/.travis.yml +0 -17
- data/node_modules/jszip/CHANGES.md +0 -163
- data/node_modules/jszip/LICENSE.markdown +0 -651
- data/node_modules/jszip/README.markdown +0 -35
- data/node_modules/jszip/dist/jszip.js +0 -30
- data/node_modules/jszip/dist/jszip.min.js +0 -13
- data/node_modules/jszip/index.d.ts +0 -270
- data/node_modules/jszip/lib/base64.js +0 -106
- data/node_modules/jszip/lib/compressedObject.js +0 -74
- data/node_modules/jszip/lib/compressions.js +0 -14
- data/node_modules/jszip/lib/crc32.js +0 -77
- data/node_modules/jszip/lib/defaults.js +0 -11
- data/node_modules/jszip/lib/external.js +0 -19
- data/node_modules/jszip/lib/flate.js +0 -85
- data/node_modules/jszip/lib/generate/ZipFileWorker.js +0 -540
- data/node_modules/jszip/lib/generate/index.js +0 -57
- data/node_modules/jszip/lib/index.js +0 -52
- data/node_modules/jszip/lib/license_header.js +0 -11
- data/node_modules/jszip/lib/load.js +0 -81
- data/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +0 -74
- data/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +0 -42
- data/node_modules/jszip/lib/nodejsUtils.js +0 -57
- data/node_modules/jszip/lib/object.js +0 -389
- data/node_modules/jszip/lib/readable-stream-browser.js +0 -9
- data/node_modules/jszip/lib/reader/ArrayReader.js +0 -57
- data/node_modules/jszip/lib/reader/DataReader.js +0 -116
- data/node_modules/jszip/lib/reader/NodeBufferReader.js +0 -19
- data/node_modules/jszip/lib/reader/StringReader.js +0 -38
- data/node_modules/jszip/lib/reader/Uint8ArrayReader.js +0 -22
- data/node_modules/jszip/lib/reader/readerFor.js +0 -28
- data/node_modules/jszip/lib/signature.js +0 -7
- data/node_modules/jszip/lib/stream/ConvertWorker.js +0 -26
- data/node_modules/jszip/lib/stream/Crc32Probe.js +0 -24
- data/node_modules/jszip/lib/stream/DataLengthProbe.js +0 -29
- data/node_modules/jszip/lib/stream/DataWorker.js +0 -116
- data/node_modules/jszip/lib/stream/GenericWorker.js +0 -263
- data/node_modules/jszip/lib/stream/StreamHelper.js +0 -212
- data/node_modules/jszip/lib/support.js +0 -38
- data/node_modules/jszip/lib/utf8.js +0 -275
- data/node_modules/jszip/lib/utils.js +0 -476
- data/node_modules/jszip/lib/zipEntries.js +0 -262
- data/node_modules/jszip/lib/zipEntry.js +0 -294
- data/node_modules/jszip/lib/zipObject.js +0 -133
- data/node_modules/jszip/package.json +0 -63
- data/node_modules/jszip/vendor/FileSaver.js +0 -247
- data/node_modules/lie/README.md +0 -62
- data/node_modules/lie/dist/lie.js +0 -350
- data/node_modules/lie/dist/lie.min.js +0 -1
- data/node_modules/lie/dist/lie.polyfill.js +0 -358
- data/node_modules/lie/dist/lie.polyfill.min.js +0 -1
- data/node_modules/lie/lib/browser.js +0 -273
- data/node_modules/lie/lib/index.js +0 -298
- data/node_modules/lie/license.md +0 -7
- data/node_modules/lie/lie.d.ts +0 -244
- data/node_modules/lie/package.json +0 -69
- data/node_modules/lie/polyfill.js +0 -4
- data/node_modules/minimatch/LICENSE +0 -15
- data/node_modules/minimatch/README.md +0 -209
- data/node_modules/minimatch/minimatch.js +0 -923
- data/node_modules/minimatch/package.json +0 -30
- data/node_modules/once/LICENSE +0 -15
- data/node_modules/once/README.md +0 -79
- data/node_modules/once/once.js +0 -42
- data/node_modules/once/package.json +0 -33
- data/node_modules/pako/CHANGELOG.md +0 -164
- data/node_modules/pako/LICENSE +0 -21
- data/node_modules/pako/README.md +0 -191
- data/node_modules/pako/dist/pako.js +0 -6818
- data/node_modules/pako/dist/pako.min.js +0 -1
- data/node_modules/pako/dist/pako_deflate.js +0 -3997
- data/node_modules/pako/dist/pako_deflate.min.js +0 -1
- data/node_modules/pako/dist/pako_inflate.js +0 -3300
- data/node_modules/pako/dist/pako_inflate.min.js +0 -1
- data/node_modules/pako/index.js +0 -14
- data/node_modules/pako/lib/deflate.js +0 -400
- data/node_modules/pako/lib/inflate.js +0 -423
- data/node_modules/pako/lib/utils/common.js +0 -105
- data/node_modules/pako/lib/utils/strings.js +0 -187
- data/node_modules/pako/lib/zlib/README +0 -59
- data/node_modules/pako/lib/zlib/adler32.js +0 -51
- data/node_modules/pako/lib/zlib/constants.js +0 -68
- data/node_modules/pako/lib/zlib/crc32.js +0 -59
- data/node_modules/pako/lib/zlib/deflate.js +0 -1874
- data/node_modules/pako/lib/zlib/gzheader.js +0 -58
- data/node_modules/pako/lib/zlib/inffast.js +0 -345
- data/node_modules/pako/lib/zlib/inflate.js +0 -1556
- data/node_modules/pako/lib/zlib/inftrees.js +0 -343
- data/node_modules/pako/lib/zlib/messages.js +0 -32
- data/node_modules/pako/lib/zlib/trees.js +0 -1222
- data/node_modules/pako/lib/zlib/zstream.js +0 -47
- data/node_modules/pako/package.json +0 -44
- data/node_modules/path-is-absolute/index.js +0 -20
- data/node_modules/path-is-absolute/license +0 -21
- data/node_modules/path-is-absolute/package.json +0 -43
- data/node_modules/path-is-absolute/readme.md +0 -59
- data/node_modules/process-nextick-args/index.js +0 -45
- data/node_modules/process-nextick-args/license.md +0 -19
- data/node_modules/process-nextick-args/package.json +0 -25
- data/node_modules/process-nextick-args/readme.md +0 -18
- data/node_modules/readable-stream/.travis.yml +0 -34
- data/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- data/node_modules/readable-stream/GOVERNANCE.md +0 -136
- data/node_modules/readable-stream/LICENSE +0 -47
- data/node_modules/readable-stream/README.md +0 -58
- data/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
- data/node_modules/readable-stream/duplex-browser.js +0 -1
- data/node_modules/readable-stream/duplex.js +0 -1
- data/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
- data/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
- data/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
- data/node_modules/readable-stream/lib/_stream_transform.js +0 -214
- data/node_modules/readable-stream/lib/_stream_writable.js +0 -687
- data/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
- data/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
- data/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- data/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- data/node_modules/readable-stream/package.json +0 -52
- data/node_modules/readable-stream/passthrough.js +0 -1
- data/node_modules/readable-stream/readable-browser.js +0 -7
- data/node_modules/readable-stream/readable.js +0 -19
- data/node_modules/readable-stream/transform.js +0 -1
- data/node_modules/readable-stream/writable-browser.js +0 -1
- data/node_modules/readable-stream/writable.js +0 -8
- data/node_modules/rimraf/LICENSE +0 -15
- data/node_modules/rimraf/README.md +0 -101
- data/node_modules/rimraf/bin.js +0 -50
- data/node_modules/rimraf/package.json +0 -29
- data/node_modules/rimraf/rimraf.js +0 -372
- data/node_modules/safe-buffer/LICENSE +0 -21
- data/node_modules/safe-buffer/README.md +0 -584
- data/node_modules/safe-buffer/index.d.ts +0 -187
- data/node_modules/safe-buffer/index.js +0 -62
- data/node_modules/safe-buffer/package.json +0 -37
- data/node_modules/selenium-webdriver/CHANGES.md +0 -1114
- data/node_modules/selenium-webdriver/LICENSE +0 -202
- data/node_modules/selenium-webdriver/NOTICE +0 -2
- data/node_modules/selenium-webdriver/README.md +0 -229
- data/node_modules/selenium-webdriver/chrome.js +0 -295
- data/node_modules/selenium-webdriver/chromium.js +0 -829
- data/node_modules/selenium-webdriver/devtools/CDPConnection.js +0 -35
- data/node_modules/selenium-webdriver/edge.js +0 -224
- data/node_modules/selenium-webdriver/example/chrome_android.js +0 -45
- data/node_modules/selenium-webdriver/example/chrome_mobile_emulation.js +0 -46
- data/node_modules/selenium-webdriver/example/firefox_channels.js +0 -84
- data/node_modules/selenium-webdriver/example/google_search.js +0 -50
- data/node_modules/selenium-webdriver/example/google_search_test.js +0 -70
- data/node_modules/selenium-webdriver/example/headless.js +0 -63
- data/node_modules/selenium-webdriver/example/logging.js +0 -64
- data/node_modules/selenium-webdriver/firefox.js +0 -789
- data/node_modules/selenium-webdriver/http/index.js +0 -324
- data/node_modules/selenium-webdriver/http/util.js +0 -172
- data/node_modules/selenium-webdriver/ie.js +0 -503
- data/node_modules/selenium-webdriver/index.js +0 -825
- data/node_modules/selenium-webdriver/io/exec.js +0 -162
- data/node_modules/selenium-webdriver/io/index.js +0 -348
- data/node_modules/selenium-webdriver/io/zip.js +0 -223
- data/node_modules/selenium-webdriver/lib/atoms/find-elements.js +0 -123
- data/node_modules/selenium-webdriver/lib/atoms/get-attribute.js +0 -101
- data/node_modules/selenium-webdriver/lib/atoms/is-displayed.js +0 -101
- data/node_modules/selenium-webdriver/lib/atoms/mutation-listener.js +0 -55
- data/node_modules/selenium-webdriver/lib/by.js +0 -415
- data/node_modules/selenium-webdriver/lib/capabilities.js +0 -553
- data/node_modules/selenium-webdriver/lib/command.js +0 -206
- data/node_modules/selenium-webdriver/lib/error.js +0 -605
- data/node_modules/selenium-webdriver/lib/http.js +0 -704
- data/node_modules/selenium-webdriver/lib/input.js +0 -946
- data/node_modules/selenium-webdriver/lib/logging.js +0 -661
- data/node_modules/selenium-webdriver/lib/promise.js +0 -285
- data/node_modules/selenium-webdriver/lib/proxy.js +0 -212
- data/node_modules/selenium-webdriver/lib/session.js +0 -77
- data/node_modules/selenium-webdriver/lib/symbols.js +0 -37
- data/node_modules/selenium-webdriver/lib/until.js +0 -429
- data/node_modules/selenium-webdriver/lib/webdriver.js +0 -2919
- data/node_modules/selenium-webdriver/net/index.js +0 -107
- data/node_modules/selenium-webdriver/net/portprober.js +0 -75
- data/node_modules/selenium-webdriver/opera.js +0 -406
- data/node_modules/selenium-webdriver/package.json +0 -54
- data/node_modules/selenium-webdriver/proxy.js +0 -32
- data/node_modules/selenium-webdriver/remote/index.js +0 -624
- data/node_modules/selenium-webdriver/safari.js +0 -168
- data/node_modules/selenium-webdriver/testing/index.js +0 -504
- data/node_modules/set-immediate-shim/index.js +0 -7
- data/node_modules/set-immediate-shim/package.json +0 -34
- data/node_modules/set-immediate-shim/readme.md +0 -31
- data/node_modules/string_decoder/.travis.yml +0 -50
- data/node_modules/string_decoder/LICENSE +0 -48
- data/node_modules/string_decoder/README.md +0 -47
- data/node_modules/string_decoder/lib/string_decoder.js +0 -296
- data/node_modules/string_decoder/package.json +0 -31
- data/node_modules/tmp/CHANGELOG.md +0 -288
- data/node_modules/tmp/LICENSE +0 -21
- data/node_modules/tmp/README.md +0 -365
- data/node_modules/tmp/lib/tmp.js +0 -780
- data/node_modules/tmp/node_modules/.bin/rimraf +0 -1
- data/node_modules/tmp/node_modules/rimraf/CHANGELOG.md +0 -65
- data/node_modules/tmp/node_modules/rimraf/LICENSE +0 -15
- data/node_modules/tmp/node_modules/rimraf/README.md +0 -101
- data/node_modules/tmp/node_modules/rimraf/bin.js +0 -68
- data/node_modules/tmp/node_modules/rimraf/package.json +0 -32
- data/node_modules/tmp/node_modules/rimraf/rimraf.js +0 -360
- data/node_modules/tmp/package.json +0 -58
- data/node_modules/util-deprecate/History.md +0 -16
- data/node_modules/util-deprecate/LICENSE +0 -24
- data/node_modules/util-deprecate/README.md +0 -53
- data/node_modules/util-deprecate/browser.js +0 -67
- data/node_modules/util-deprecate/node.js +0 -6
- data/node_modules/util-deprecate/package.json +0 -27
- data/node_modules/wrappy/LICENSE +0 -15
- data/node_modules/wrappy/README.md +0 -36
- data/node_modules/wrappy/package.json +0 -29
- data/node_modules/wrappy/wrappy.js +0 -33
- data/node_modules/ws/LICENSE +0 -21
- data/node_modules/ws/README.md +0 -496
- data/node_modules/ws/browser.js +0 -8
- data/node_modules/ws/index.js +0 -10
- data/node_modules/ws/lib/buffer-util.js +0 -129
- data/node_modules/ws/lib/constants.js +0 -10
- data/node_modules/ws/lib/event-target.js +0 -184
- data/node_modules/ws/lib/extension.js +0 -223
- data/node_modules/ws/lib/limiter.js +0 -55
- data/node_modules/ws/lib/permessage-deflate.js +0 -517
- data/node_modules/ws/lib/receiver.js +0 -507
- data/node_modules/ws/lib/sender.js +0 -405
- data/node_modules/ws/lib/stream.js +0 -165
- data/node_modules/ws/lib/validation.js +0 -104
- data/node_modules/ws/lib/websocket-server.js +0 -418
- data/node_modules/ws/lib/websocket.js +0 -942
- data/node_modules/ws/package.json +0 -56
- data/package-lock.json +0 -458
- data/package.json +0 -5
- data/selenium.log +0 -1
- data/spec.md +0 -6
- data/test.data +0 -2110
@@ -1,9 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This file is used by module bundlers (browserify/webpack/etc) when
|
3
|
-
* including a stream implementation. We use "readable-stream" to get a
|
4
|
-
* consistent behavior between nodejs versions but bundlers often have a shim
|
5
|
-
* for "stream". Using this shim greatly improve the compatibility and greatly
|
6
|
-
* reduce the final size of the bundle (only one stream implementation, not
|
7
|
-
* two).
|
8
|
-
*/
|
9
|
-
module.exports = require("stream");
|
@@ -1,57 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
var DataReader = require('./DataReader');
|
3
|
-
var utils = require('../utils');
|
4
|
-
|
5
|
-
function ArrayReader(data) {
|
6
|
-
DataReader.call(this, data);
|
7
|
-
for(var i = 0; i < this.data.length; i++) {
|
8
|
-
data[i] = data[i] & 0xFF;
|
9
|
-
}
|
10
|
-
}
|
11
|
-
utils.inherits(ArrayReader, DataReader);
|
12
|
-
/**
|
13
|
-
* @see DataReader.byteAt
|
14
|
-
*/
|
15
|
-
ArrayReader.prototype.byteAt = function(i) {
|
16
|
-
return this.data[this.zero + i];
|
17
|
-
};
|
18
|
-
/**
|
19
|
-
* @see DataReader.lastIndexOfSignature
|
20
|
-
*/
|
21
|
-
ArrayReader.prototype.lastIndexOfSignature = function(sig) {
|
22
|
-
var sig0 = sig.charCodeAt(0),
|
23
|
-
sig1 = sig.charCodeAt(1),
|
24
|
-
sig2 = sig.charCodeAt(2),
|
25
|
-
sig3 = sig.charCodeAt(3);
|
26
|
-
for (var i = this.length - 4; i >= 0; --i) {
|
27
|
-
if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) {
|
28
|
-
return i - this.zero;
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
return -1;
|
33
|
-
};
|
34
|
-
/**
|
35
|
-
* @see DataReader.readAndCheckSignature
|
36
|
-
*/
|
37
|
-
ArrayReader.prototype.readAndCheckSignature = function (sig) {
|
38
|
-
var sig0 = sig.charCodeAt(0),
|
39
|
-
sig1 = sig.charCodeAt(1),
|
40
|
-
sig2 = sig.charCodeAt(2),
|
41
|
-
sig3 = sig.charCodeAt(3),
|
42
|
-
data = this.readData(4);
|
43
|
-
return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3];
|
44
|
-
};
|
45
|
-
/**
|
46
|
-
* @see DataReader.readData
|
47
|
-
*/
|
48
|
-
ArrayReader.prototype.readData = function(size) {
|
49
|
-
this.checkOffset(size);
|
50
|
-
if(size === 0) {
|
51
|
-
return [];
|
52
|
-
}
|
53
|
-
var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
|
54
|
-
this.index += size;
|
55
|
-
return result;
|
56
|
-
};
|
57
|
-
module.exports = ArrayReader;
|
@@ -1,116 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
var utils = require('../utils');
|
3
|
-
|
4
|
-
function DataReader(data) {
|
5
|
-
this.data = data; // type : see implementation
|
6
|
-
this.length = data.length;
|
7
|
-
this.index = 0;
|
8
|
-
this.zero = 0;
|
9
|
-
}
|
10
|
-
DataReader.prototype = {
|
11
|
-
/**
|
12
|
-
* Check that the offset will not go too far.
|
13
|
-
* @param {string} offset the additional offset to check.
|
14
|
-
* @throws {Error} an Error if the offset is out of bounds.
|
15
|
-
*/
|
16
|
-
checkOffset: function(offset) {
|
17
|
-
this.checkIndex(this.index + offset);
|
18
|
-
},
|
19
|
-
/**
|
20
|
-
* Check that the specified index will not be too far.
|
21
|
-
* @param {string} newIndex the index to check.
|
22
|
-
* @throws {Error} an Error if the index is out of bounds.
|
23
|
-
*/
|
24
|
-
checkIndex: function(newIndex) {
|
25
|
-
if (this.length < this.zero + newIndex || newIndex < 0) {
|
26
|
-
throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?");
|
27
|
-
}
|
28
|
-
},
|
29
|
-
/**
|
30
|
-
* Change the index.
|
31
|
-
* @param {number} newIndex The new index.
|
32
|
-
* @throws {Error} if the new index is out of the data.
|
33
|
-
*/
|
34
|
-
setIndex: function(newIndex) {
|
35
|
-
this.checkIndex(newIndex);
|
36
|
-
this.index = newIndex;
|
37
|
-
},
|
38
|
-
/**
|
39
|
-
* Skip the next n bytes.
|
40
|
-
* @param {number} n the number of bytes to skip.
|
41
|
-
* @throws {Error} if the new index is out of the data.
|
42
|
-
*/
|
43
|
-
skip: function(n) {
|
44
|
-
this.setIndex(this.index + n);
|
45
|
-
},
|
46
|
-
/**
|
47
|
-
* Get the byte at the specified index.
|
48
|
-
* @param {number} i the index to use.
|
49
|
-
* @return {number} a byte.
|
50
|
-
*/
|
51
|
-
byteAt: function(i) {
|
52
|
-
// see implementations
|
53
|
-
},
|
54
|
-
/**
|
55
|
-
* Get the next number with a given byte size.
|
56
|
-
* @param {number} size the number of bytes to read.
|
57
|
-
* @return {number} the corresponding number.
|
58
|
-
*/
|
59
|
-
readInt: function(size) {
|
60
|
-
var result = 0,
|
61
|
-
i;
|
62
|
-
this.checkOffset(size);
|
63
|
-
for (i = this.index + size - 1; i >= this.index; i--) {
|
64
|
-
result = (result << 8) + this.byteAt(i);
|
65
|
-
}
|
66
|
-
this.index += size;
|
67
|
-
return result;
|
68
|
-
},
|
69
|
-
/**
|
70
|
-
* Get the next string with a given byte size.
|
71
|
-
* @param {number} size the number of bytes to read.
|
72
|
-
* @return {string} the corresponding string.
|
73
|
-
*/
|
74
|
-
readString: function(size) {
|
75
|
-
return utils.transformTo("string", this.readData(size));
|
76
|
-
},
|
77
|
-
/**
|
78
|
-
* Get raw data without conversion, <size> bytes.
|
79
|
-
* @param {number} size the number of bytes to read.
|
80
|
-
* @return {Object} the raw data, implementation specific.
|
81
|
-
*/
|
82
|
-
readData: function(size) {
|
83
|
-
// see implementations
|
84
|
-
},
|
85
|
-
/**
|
86
|
-
* Find the last occurrence of a zip signature (4 bytes).
|
87
|
-
* @param {string} sig the signature to find.
|
88
|
-
* @return {number} the index of the last occurrence, -1 if not found.
|
89
|
-
*/
|
90
|
-
lastIndexOfSignature: function(sig) {
|
91
|
-
// see implementations
|
92
|
-
},
|
93
|
-
/**
|
94
|
-
* Read the signature (4 bytes) at the current position and compare it with sig.
|
95
|
-
* @param {string} sig the expected signature
|
96
|
-
* @return {boolean} true if the signature matches, false otherwise.
|
97
|
-
*/
|
98
|
-
readAndCheckSignature: function(sig) {
|
99
|
-
// see implementations
|
100
|
-
},
|
101
|
-
/**
|
102
|
-
* Get the next date.
|
103
|
-
* @return {Date} the date.
|
104
|
-
*/
|
105
|
-
readDate: function() {
|
106
|
-
var dostime = this.readInt(4);
|
107
|
-
return new Date(Date.UTC(
|
108
|
-
((dostime >> 25) & 0x7f) + 1980, // year
|
109
|
-
((dostime >> 21) & 0x0f) - 1, // month
|
110
|
-
(dostime >> 16) & 0x1f, // day
|
111
|
-
(dostime >> 11) & 0x1f, // hour
|
112
|
-
(dostime >> 5) & 0x3f, // minute
|
113
|
-
(dostime & 0x1f) << 1)); // second
|
114
|
-
}
|
115
|
-
};
|
116
|
-
module.exports = DataReader;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
var Uint8ArrayReader = require('./Uint8ArrayReader');
|
3
|
-
var utils = require('../utils');
|
4
|
-
|
5
|
-
function NodeBufferReader(data) {
|
6
|
-
Uint8ArrayReader.call(this, data);
|
7
|
-
}
|
8
|
-
utils.inherits(NodeBufferReader, Uint8ArrayReader);
|
9
|
-
|
10
|
-
/**
|
11
|
-
* @see DataReader.readData
|
12
|
-
*/
|
13
|
-
NodeBufferReader.prototype.readData = function(size) {
|
14
|
-
this.checkOffset(size);
|
15
|
-
var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
|
16
|
-
this.index += size;
|
17
|
-
return result;
|
18
|
-
};
|
19
|
-
module.exports = NodeBufferReader;
|
@@ -1,38 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
var DataReader = require('./DataReader');
|
3
|
-
var utils = require('../utils');
|
4
|
-
|
5
|
-
function StringReader(data) {
|
6
|
-
DataReader.call(this, data);
|
7
|
-
}
|
8
|
-
utils.inherits(StringReader, DataReader);
|
9
|
-
/**
|
10
|
-
* @see DataReader.byteAt
|
11
|
-
*/
|
12
|
-
StringReader.prototype.byteAt = function(i) {
|
13
|
-
return this.data.charCodeAt(this.zero + i);
|
14
|
-
};
|
15
|
-
/**
|
16
|
-
* @see DataReader.lastIndexOfSignature
|
17
|
-
*/
|
18
|
-
StringReader.prototype.lastIndexOfSignature = function(sig) {
|
19
|
-
return this.data.lastIndexOf(sig) - this.zero;
|
20
|
-
};
|
21
|
-
/**
|
22
|
-
* @see DataReader.readAndCheckSignature
|
23
|
-
*/
|
24
|
-
StringReader.prototype.readAndCheckSignature = function (sig) {
|
25
|
-
var data = this.readData(4);
|
26
|
-
return sig === data;
|
27
|
-
};
|
28
|
-
/**
|
29
|
-
* @see DataReader.readData
|
30
|
-
*/
|
31
|
-
StringReader.prototype.readData = function(size) {
|
32
|
-
this.checkOffset(size);
|
33
|
-
// this will work because the constructor applied the "& 0xff" mask.
|
34
|
-
var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
|
35
|
-
this.index += size;
|
36
|
-
return result;
|
37
|
-
};
|
38
|
-
module.exports = StringReader;
|
@@ -1,22 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
var ArrayReader = require('./ArrayReader');
|
3
|
-
var utils = require('../utils');
|
4
|
-
|
5
|
-
function Uint8ArrayReader(data) {
|
6
|
-
ArrayReader.call(this, data);
|
7
|
-
}
|
8
|
-
utils.inherits(Uint8ArrayReader, ArrayReader);
|
9
|
-
/**
|
10
|
-
* @see DataReader.readData
|
11
|
-
*/
|
12
|
-
Uint8ArrayReader.prototype.readData = function(size) {
|
13
|
-
this.checkOffset(size);
|
14
|
-
if(size === 0) {
|
15
|
-
// in IE10, when using subarray(idx, idx), we get the array [0x00] instead of [].
|
16
|
-
return new Uint8Array(0);
|
17
|
-
}
|
18
|
-
var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size);
|
19
|
-
this.index += size;
|
20
|
-
return result;
|
21
|
-
};
|
22
|
-
module.exports = Uint8ArrayReader;
|
@@ -1,28 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var utils = require('../utils');
|
4
|
-
var support = require('../support');
|
5
|
-
var ArrayReader = require('./ArrayReader');
|
6
|
-
var StringReader = require('./StringReader');
|
7
|
-
var NodeBufferReader = require('./NodeBufferReader');
|
8
|
-
var Uint8ArrayReader = require('./Uint8ArrayReader');
|
9
|
-
|
10
|
-
/**
|
11
|
-
* Create a reader adapted to the data.
|
12
|
-
* @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read.
|
13
|
-
* @return {DataReader} the data reader.
|
14
|
-
*/
|
15
|
-
module.exports = function (data) {
|
16
|
-
var type = utils.getTypeOf(data);
|
17
|
-
utils.checkSupport(type);
|
18
|
-
if (type === "string" && !support.uint8array) {
|
19
|
-
return new StringReader(data);
|
20
|
-
}
|
21
|
-
if (type === "nodebuffer") {
|
22
|
-
return new NodeBufferReader(data);
|
23
|
-
}
|
24
|
-
if (support.uint8array) {
|
25
|
-
return new Uint8ArrayReader(utils.transformTo("uint8array", data));
|
26
|
-
}
|
27
|
-
return new ArrayReader(utils.transformTo("array", data));
|
28
|
-
};
|
@@ -1,7 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
exports.LOCAL_FILE_HEADER = "PK\x03\x04";
|
3
|
-
exports.CENTRAL_FILE_HEADER = "PK\x01\x02";
|
4
|
-
exports.CENTRAL_DIRECTORY_END = "PK\x05\x06";
|
5
|
-
exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07";
|
6
|
-
exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06";
|
7
|
-
exports.DATA_DESCRIPTOR = "PK\x07\x08";
|
@@ -1,26 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var GenericWorker = require('./GenericWorker');
|
4
|
-
var utils = require('../utils');
|
5
|
-
|
6
|
-
/**
|
7
|
-
* A worker which convert chunks to a specified type.
|
8
|
-
* @constructor
|
9
|
-
* @param {String} destType the destination type.
|
10
|
-
*/
|
11
|
-
function ConvertWorker(destType) {
|
12
|
-
GenericWorker.call(this, "ConvertWorker to " + destType);
|
13
|
-
this.destType = destType;
|
14
|
-
}
|
15
|
-
utils.inherits(ConvertWorker, GenericWorker);
|
16
|
-
|
17
|
-
/**
|
18
|
-
* @see GenericWorker.processChunk
|
19
|
-
*/
|
20
|
-
ConvertWorker.prototype.processChunk = function (chunk) {
|
21
|
-
this.push({
|
22
|
-
data : utils.transformTo(this.destType, chunk.data),
|
23
|
-
meta : chunk.meta
|
24
|
-
});
|
25
|
-
};
|
26
|
-
module.exports = ConvertWorker;
|
@@ -1,24 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var GenericWorker = require('./GenericWorker');
|
4
|
-
var crc32 = require('../crc32');
|
5
|
-
var utils = require('../utils');
|
6
|
-
|
7
|
-
/**
|
8
|
-
* A worker which calculate the crc32 of the data flowing through.
|
9
|
-
* @constructor
|
10
|
-
*/
|
11
|
-
function Crc32Probe() {
|
12
|
-
GenericWorker.call(this, "Crc32Probe");
|
13
|
-
this.withStreamInfo("crc32", 0);
|
14
|
-
}
|
15
|
-
utils.inherits(Crc32Probe, GenericWorker);
|
16
|
-
|
17
|
-
/**
|
18
|
-
* @see GenericWorker.processChunk
|
19
|
-
*/
|
20
|
-
Crc32Probe.prototype.processChunk = function (chunk) {
|
21
|
-
this.streamInfo.crc32 = crc32(chunk.data, this.streamInfo.crc32 || 0);
|
22
|
-
this.push(chunk);
|
23
|
-
};
|
24
|
-
module.exports = Crc32Probe;
|
@@ -1,29 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var utils = require('../utils');
|
4
|
-
var GenericWorker = require('./GenericWorker');
|
5
|
-
|
6
|
-
/**
|
7
|
-
* A worker which calculate the total length of the data flowing through.
|
8
|
-
* @constructor
|
9
|
-
* @param {String} propName the name used to expose the length
|
10
|
-
*/
|
11
|
-
function DataLengthProbe(propName) {
|
12
|
-
GenericWorker.call(this, "DataLengthProbe for " + propName);
|
13
|
-
this.propName = propName;
|
14
|
-
this.withStreamInfo(propName, 0);
|
15
|
-
}
|
16
|
-
utils.inherits(DataLengthProbe, GenericWorker);
|
17
|
-
|
18
|
-
/**
|
19
|
-
* @see GenericWorker.processChunk
|
20
|
-
*/
|
21
|
-
DataLengthProbe.prototype.processChunk = function (chunk) {
|
22
|
-
if(chunk) {
|
23
|
-
var length = this.streamInfo[this.propName] || 0;
|
24
|
-
this.streamInfo[this.propName] = length + chunk.data.length;
|
25
|
-
}
|
26
|
-
GenericWorker.prototype.processChunk.call(this, chunk);
|
27
|
-
};
|
28
|
-
module.exports = DataLengthProbe;
|
29
|
-
|
@@ -1,116 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var utils = require('../utils');
|
4
|
-
var GenericWorker = require('./GenericWorker');
|
5
|
-
|
6
|
-
// the size of the generated chunks
|
7
|
-
// TODO expose this as a public variable
|
8
|
-
var DEFAULT_BLOCK_SIZE = 16 * 1024;
|
9
|
-
|
10
|
-
/**
|
11
|
-
* A worker that reads a content and emits chunks.
|
12
|
-
* @constructor
|
13
|
-
* @param {Promise} dataP the promise of the data to split
|
14
|
-
*/
|
15
|
-
function DataWorker(dataP) {
|
16
|
-
GenericWorker.call(this, "DataWorker");
|
17
|
-
var self = this;
|
18
|
-
this.dataIsReady = false;
|
19
|
-
this.index = 0;
|
20
|
-
this.max = 0;
|
21
|
-
this.data = null;
|
22
|
-
this.type = "";
|
23
|
-
|
24
|
-
this._tickScheduled = false;
|
25
|
-
|
26
|
-
dataP.then(function (data) {
|
27
|
-
self.dataIsReady = true;
|
28
|
-
self.data = data;
|
29
|
-
self.max = data && data.length || 0;
|
30
|
-
self.type = utils.getTypeOf(data);
|
31
|
-
if(!self.isPaused) {
|
32
|
-
self._tickAndRepeat();
|
33
|
-
}
|
34
|
-
}, function (e) {
|
35
|
-
self.error(e);
|
36
|
-
});
|
37
|
-
}
|
38
|
-
|
39
|
-
utils.inherits(DataWorker, GenericWorker);
|
40
|
-
|
41
|
-
/**
|
42
|
-
* @see GenericWorker.cleanUp
|
43
|
-
*/
|
44
|
-
DataWorker.prototype.cleanUp = function () {
|
45
|
-
GenericWorker.prototype.cleanUp.call(this);
|
46
|
-
this.data = null;
|
47
|
-
};
|
48
|
-
|
49
|
-
/**
|
50
|
-
* @see GenericWorker.resume
|
51
|
-
*/
|
52
|
-
DataWorker.prototype.resume = function () {
|
53
|
-
if(!GenericWorker.prototype.resume.call(this)) {
|
54
|
-
return false;
|
55
|
-
}
|
56
|
-
|
57
|
-
if (!this._tickScheduled && this.dataIsReady) {
|
58
|
-
this._tickScheduled = true;
|
59
|
-
utils.delay(this._tickAndRepeat, [], this);
|
60
|
-
}
|
61
|
-
return true;
|
62
|
-
};
|
63
|
-
|
64
|
-
/**
|
65
|
-
* Trigger a tick a schedule an other call to this function.
|
66
|
-
*/
|
67
|
-
DataWorker.prototype._tickAndRepeat = function() {
|
68
|
-
this._tickScheduled = false;
|
69
|
-
if(this.isPaused || this.isFinished) {
|
70
|
-
return;
|
71
|
-
}
|
72
|
-
this._tick();
|
73
|
-
if(!this.isFinished) {
|
74
|
-
utils.delay(this._tickAndRepeat, [], this);
|
75
|
-
this._tickScheduled = true;
|
76
|
-
}
|
77
|
-
};
|
78
|
-
|
79
|
-
/**
|
80
|
-
* Read and push a chunk.
|
81
|
-
*/
|
82
|
-
DataWorker.prototype._tick = function() {
|
83
|
-
|
84
|
-
if(this.isPaused || this.isFinished) {
|
85
|
-
return false;
|
86
|
-
}
|
87
|
-
|
88
|
-
var size = DEFAULT_BLOCK_SIZE;
|
89
|
-
var data = null, nextIndex = Math.min(this.max, this.index + size);
|
90
|
-
if (this.index >= this.max) {
|
91
|
-
// EOF
|
92
|
-
return this.end();
|
93
|
-
} else {
|
94
|
-
switch(this.type) {
|
95
|
-
case "string":
|
96
|
-
data = this.data.substring(this.index, nextIndex);
|
97
|
-
break;
|
98
|
-
case "uint8array":
|
99
|
-
data = this.data.subarray(this.index, nextIndex);
|
100
|
-
break;
|
101
|
-
case "array":
|
102
|
-
case "nodebuffer":
|
103
|
-
data = this.data.slice(this.index, nextIndex);
|
104
|
-
break;
|
105
|
-
}
|
106
|
-
this.index = nextIndex;
|
107
|
-
return this.push({
|
108
|
-
data : data,
|
109
|
-
meta : {
|
110
|
-
percent : this.max ? this.index / this.max * 100 : 0
|
111
|
-
}
|
112
|
-
});
|
113
|
-
}
|
114
|
-
};
|
115
|
-
|
116
|
-
module.exports = DataWorker;
|