@gmod/cram 1.5.9 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +182 -172
  3. package/dist/craiIndex.d.ts +37 -0
  4. package/dist/craiIndex.js +196 -301
  5. package/dist/craiIndex.js.map +1 -0
  6. package/dist/cram-bundle.js +6 -15
  7. package/dist/cramFile/codecs/_base.d.ts +6 -0
  8. package/dist/cramFile/codecs/_base.js +44 -53
  9. package/dist/cramFile/codecs/_base.js.map +1 -0
  10. package/dist/cramFile/codecs/beta.d.ts +4 -0
  11. package/dist/cramFile/codecs/beta.js +38 -48
  12. package/dist/cramFile/codecs/beta.js.map +1 -0
  13. package/dist/cramFile/codecs/byteArrayLength.d.ts +8 -0
  14. package/dist/cramFile/codecs/byteArrayLength.js +58 -78
  15. package/dist/cramFile/codecs/byteArrayLength.js.map +1 -0
  16. package/dist/cramFile/codecs/byteArrayStop.d.ts +6 -0
  17. package/dist/cramFile/codecs/byteArrayStop.js +62 -76
  18. package/dist/cramFile/codecs/byteArrayStop.js.map +1 -0
  19. package/dist/cramFile/codecs/external.d.ts +7 -0
  20. package/dist/cramFile/codecs/external.js +63 -81
  21. package/dist/cramFile/codecs/external.js.map +1 -0
  22. package/dist/cramFile/codecs/gamma.d.ts +4 -0
  23. package/dist/cramFile/codecs/gamma.js +43 -56
  24. package/dist/cramFile/codecs/gamma.js.map +1 -0
  25. package/dist/cramFile/codecs/huffman.d.ts +17 -0
  26. package/dist/cramFile/codecs/huffman.js +126 -199
  27. package/dist/cramFile/codecs/huffman.js.map +1 -0
  28. package/dist/cramFile/codecs/index.d.ts +2 -0
  29. package/dist/cramFile/codecs/index.js +31 -38
  30. package/dist/cramFile/codecs/index.js.map +1 -0
  31. package/dist/cramFile/codecs/subexp.d.ts +4 -0
  32. package/dist/cramFile/codecs/subexp.js +51 -64
  33. package/dist/cramFile/codecs/subexp.js.map +1 -0
  34. package/dist/cramFile/constants.d.ts +36 -0
  35. package/dist/cramFile/constants.js +52 -50
  36. package/dist/cramFile/constants.js.map +1 -0
  37. package/dist/cramFile/container/compressionScheme.d.ts +23 -0
  38. package/dist/cramFile/container/compressionScheme.js +115 -153
  39. package/dist/cramFile/container/compressionScheme.js.map +1 -0
  40. package/dist/cramFile/container/index.d.ts +13 -0
  41. package/dist/cramFile/container/index.js +169 -283
  42. package/dist/cramFile/container/index.js.map +1 -0
  43. package/dist/cramFile/file.d.ts +63 -0
  44. package/dist/cramFile/file.js +440 -766
  45. package/dist/cramFile/file.js.map +1 -0
  46. package/dist/cramFile/index.d.ts +2 -0
  47. package/dist/cramFile/index.js +7 -4
  48. package/dist/cramFile/index.js.map +1 -0
  49. package/dist/cramFile/record.d.ts +79 -0
  50. package/dist/cramFile/record.js +253 -308
  51. package/dist/cramFile/record.js.map +1 -0
  52. package/dist/cramFile/sectionParsers.d.ts +18 -0
  53. package/dist/cramFile/sectionParsers.js +324 -362
  54. package/dist/cramFile/sectionParsers.js.map +1 -0
  55. package/dist/cramFile/slice/decodeRecord.d.ts +2 -0
  56. package/dist/cramFile/slice/decodeRecord.js +278 -298
  57. package/dist/cramFile/slice/decodeRecord.js.map +1 -0
  58. package/dist/cramFile/slice/index.d.ts +20 -0
  59. package/dist/cramFile/slice/index.js +488 -789
  60. package/dist/cramFile/slice/index.js.map +1 -0
  61. package/dist/cramFile/util.d.ts +5 -0
  62. package/dist/cramFile/util.js +158 -144
  63. package/dist/cramFile/util.js.map +1 -0
  64. package/dist/errors.d.ts +23 -0
  65. package/dist/errors.js +66 -103
  66. package/dist/errors.js.map +1 -0
  67. package/dist/index.d.ts +4 -0
  68. package/dist/index.js +12 -12
  69. package/dist/index.js.map +1 -0
  70. package/dist/indexedCramFile.d.ts +39 -0
  71. package/dist/indexedCramFile.js +213 -315
  72. package/dist/indexedCramFile.js.map +1 -0
  73. package/dist/io/bufferCache.d.ts +12 -0
  74. package/dist/io/bufferCache.js +108 -128
  75. package/dist/io/bufferCache.js.map +1 -0
  76. package/dist/io/index.d.ts +5 -0
  77. package/dist/io/index.js +29 -27
  78. package/dist/io/index.js.map +1 -0
  79. package/dist/io/localFile.d.ts +10 -0
  80. package/dist/io/localFile.js +105 -162
  81. package/dist/io/localFile.js.map +1 -0
  82. package/dist/io/remoteFile.d.ts +16 -0
  83. package/dist/io/remoteFile.js +137 -206
  84. package/dist/io/remoteFile.js.map +1 -0
  85. package/dist/rans/constants.d.ts +3 -0
  86. package/dist/rans/constants.js +6 -6
  87. package/dist/rans/constants.js.map +1 -0
  88. package/dist/rans/d04.d.ts +1 -0
  89. package/dist/rans/d04.js +70 -99
  90. package/dist/rans/d04.js.map +1 -0
  91. package/dist/rans/d14.d.ts +1 -0
  92. package/dist/rans/d14.js +55 -93
  93. package/dist/rans/d14.js.map +1 -0
  94. package/dist/rans/decoding.d.ts +30 -0
  95. package/dist/rans/decoding.js +112 -159
  96. package/dist/rans/decoding.js.map +1 -0
  97. package/dist/rans/frequencies.d.ts +2 -0
  98. package/dist/rans/frequencies.js +110 -119
  99. package/dist/rans/frequencies.js.map +1 -0
  100. package/dist/rans/index.d.ts +1 -0
  101. package/dist/rans/index.js +111 -174
  102. package/dist/rans/index.js.map +1 -0
  103. package/dist/sam.d.ts +1 -0
  104. package/dist/sam.js +16 -41
  105. package/dist/sam.js.map +1 -0
  106. package/dist/unzip-pako.d.ts +2 -0
  107. package/dist/unzip-pako.js +9 -0
  108. package/dist/unzip-pako.js.map +1 -0
  109. package/dist/unzip.d.ts +2 -0
  110. package/dist/unzip.js +6 -0
  111. package/dist/unzip.js.map +1 -0
  112. package/errors.js +66 -103
  113. package/esm/craiIndex.d.ts +37 -0
  114. package/esm/craiIndex.js +158 -0
  115. package/esm/craiIndex.js.map +1 -0
  116. package/esm/cramFile/codecs/_base.d.ts +6 -0
  117. package/esm/cramFile/codecs/_base.js +42 -0
  118. package/esm/cramFile/codecs/_base.js.map +1 -0
  119. package/esm/cramFile/codecs/beta.d.ts +4 -0
  120. package/esm/cramFile/codecs/beta.js +15 -0
  121. package/esm/cramFile/codecs/beta.js.map +1 -0
  122. package/esm/cramFile/codecs/byteArrayLength.d.ts +8 -0
  123. package/esm/cramFile/codecs/byteArrayLength.js +35 -0
  124. package/esm/cramFile/codecs/byteArrayLength.js.map +1 -0
  125. package/esm/cramFile/codecs/byteArrayStop.d.ts +6 -0
  126. package/esm/cramFile/codecs/byteArrayStop.js +40 -0
  127. package/esm/cramFile/codecs/byteArrayStop.js.map +1 -0
  128. package/esm/cramFile/codecs/external.d.ts +7 -0
  129. package/esm/cramFile/codecs/external.js +40 -0
  130. package/esm/cramFile/codecs/external.js.map +1 -0
  131. package/esm/cramFile/codecs/gamma.d.ts +4 -0
  132. package/esm/cramFile/codecs/gamma.js +20 -0
  133. package/esm/cramFile/codecs/gamma.js.map +1 -0
  134. package/esm/cramFile/codecs/huffman.d.ts +17 -0
  135. package/esm/cramFile/codecs/huffman.js +107 -0
  136. package/esm/cramFile/codecs/huffman.js.map +1 -0
  137. package/esm/cramFile/codecs/index.d.ts +2 -0
  138. package/esm/cramFile/codecs/index.js +30 -0
  139. package/esm/cramFile/codecs/index.js.map +1 -0
  140. package/esm/cramFile/codecs/subexp.d.ts +4 -0
  141. package/esm/cramFile/codecs/subexp.js +28 -0
  142. package/esm/cramFile/codecs/subexp.js.map +1 -0
  143. package/esm/cramFile/constants.d.ts +36 -0
  144. package/esm/cramFile/constants.js +51 -0
  145. package/esm/cramFile/constants.js.map +1 -0
  146. package/esm/cramFile/container/compressionScheme.d.ts +23 -0
  147. package/esm/cramFile/container/compressionScheme.js +123 -0
  148. package/esm/cramFile/container/compressionScheme.js.map +1 -0
  149. package/esm/cramFile/container/index.d.ts +13 -0
  150. package/esm/cramFile/container/index.js +84 -0
  151. package/esm/cramFile/container/index.js.map +1 -0
  152. package/esm/cramFile/file.d.ts +63 -0
  153. package/esm/cramFile/file.js +281 -0
  154. package/esm/cramFile/file.js.map +1 -0
  155. package/esm/cramFile/index.d.ts +2 -0
  156. package/esm/cramFile/index.js +3 -0
  157. package/esm/cramFile/index.js.map +1 -0
  158. package/esm/cramFile/record.d.ts +79 -0
  159. package/esm/cramFile/record.js +297 -0
  160. package/esm/cramFile/record.js.map +1 -0
  161. package/esm/cramFile/sectionParsers.d.ts +18 -0
  162. package/esm/cramFile/sectionParsers.js +347 -0
  163. package/esm/cramFile/sectionParsers.js.map +1 -0
  164. package/esm/cramFile/slice/decodeRecord.d.ts +2 -0
  165. package/esm/cramFile/slice/decodeRecord.js +299 -0
  166. package/esm/cramFile/slice/decodeRecord.js.map +1 -0
  167. package/esm/cramFile/slice/index.d.ts +20 -0
  168. package/esm/cramFile/slice/index.js +364 -0
  169. package/esm/cramFile/slice/index.js.map +1 -0
  170. package/esm/cramFile/util.d.ts +5 -0
  171. package/esm/cramFile/util.js +161 -0
  172. package/esm/cramFile/util.js.map +1 -0
  173. package/esm/errors.d.ts +23 -0
  174. package/esm/errors.js +24 -0
  175. package/esm/errors.js.map +1 -0
  176. package/esm/index.d.ts +4 -0
  177. package/esm/index.js +5 -0
  178. package/esm/index.js.map +1 -0
  179. package/esm/indexedCramFile.d.ts +39 -0
  180. package/esm/indexedCramFile.js +155 -0
  181. package/esm/indexedCramFile.js.map +1 -0
  182. package/esm/io/bufferCache.d.ts +12 -0
  183. package/esm/io/bufferCache.js +54 -0
  184. package/esm/io/bufferCache.js.map +1 -0
  185. package/esm/io/index.d.ts +5 -0
  186. package/esm/io/index.js +24 -0
  187. package/esm/io/index.js.map +1 -0
  188. package/esm/io/localFile.d.ts +10 -0
  189. package/esm/io/localFile.js +31 -0
  190. package/esm/io/localFile.js.map +1 -0
  191. package/esm/io/remoteFile.d.ts +16 -0
  192. package/esm/io/remoteFile.js +64 -0
  193. package/esm/io/remoteFile.js.map +1 -0
  194. package/esm/rans/constants.d.ts +3 -0
  195. package/esm/rans/constants.js +5 -0
  196. package/esm/rans/constants.js.map +1 -0
  197. package/esm/rans/d04.d.ts +1 -0
  198. package/esm/rans/d04.js +67 -0
  199. package/esm/rans/d04.js.map +1 -0
  200. package/esm/rans/d14.d.ts +1 -0
  201. package/esm/rans/d14.js +52 -0
  202. package/esm/rans/d14.js.map +1 -0
  203. package/esm/rans/decoding.d.ts +30 -0
  204. package/esm/rans/decoding.js +118 -0
  205. package/esm/rans/decoding.js.map +1 -0
  206. package/esm/rans/frequencies.d.ts +2 -0
  207. package/esm/rans/frequencies.js +110 -0
  208. package/esm/rans/frequencies.js.map +1 -0
  209. package/esm/rans/index.d.ts +1 -0
  210. package/esm/rans/index.js +195 -0
  211. package/esm/rans/index.js.map +1 -0
  212. package/esm/sam.d.ts +1 -0
  213. package/esm/sam.js +16 -0
  214. package/esm/sam.js.map +1 -0
  215. package/esm/unzip-pako.d.ts +2 -0
  216. package/esm/unzip-pako.js +5 -0
  217. package/esm/unzip-pako.js.map +1 -0
  218. package/esm/unzip.d.ts +2 -0
  219. package/esm/unzip.js +3 -0
  220. package/esm/unzip.js.map +1 -0
  221. package/package.json +38 -35
  222. package/src/craiIndex.js +180 -0
  223. package/src/cramFile/codecs/_base.js +49 -0
  224. package/src/cramFile/codecs/beta.js +23 -0
  225. package/src/cramFile/codecs/byteArrayLength.js +55 -0
  226. package/src/cramFile/codecs/byteArrayStop.js +50 -0
  227. package/src/cramFile/codecs/external.js +54 -0
  228. package/src/cramFile/codecs/gamma.js +30 -0
  229. package/src/cramFile/codecs/huffman.js +137 -0
  230. package/src/cramFile/codecs/index.js +38 -0
  231. package/src/cramFile/codecs/subexp.js +32 -0
  232. package/src/cramFile/constants.js +55 -0
  233. package/src/cramFile/container/compressionScheme.js +144 -0
  234. package/src/cramFile/container/index.js +119 -0
  235. package/src/cramFile/file.js +347 -0
  236. package/src/cramFile/index.js +3 -0
  237. package/src/cramFile/record.js +337 -0
  238. package/src/cramFile/sectionParsers.js +379 -0
  239. package/src/cramFile/slice/decodeRecord.js +362 -0
  240. package/src/cramFile/slice/index.js +497 -0
  241. package/src/cramFile/util.js +169 -0
  242. package/src/errors.js +22 -0
  243. package/src/index.js +5 -0
  244. package/src/indexedCramFile.js +191 -0
  245. package/src/io/bufferCache.js +66 -0
  246. package/src/io/index.js +26 -0
  247. package/src/io/localFile.js +35 -0
  248. package/src/io/remoteFile.js +71 -0
  249. package/src/rans/README.md +1 -0
  250. package/src/rans/constants.js +5 -0
  251. package/src/rans/d04.js +83 -0
  252. package/src/rans/d14.js +59 -0
  253. package/src/rans/decoding.js +141 -0
  254. package/src/rans/frequencies.js +121 -0
  255. package/src/rans/index.js +249 -0
  256. package/src/sam.js +15 -0
  257. package/src/unzip-pako.ts +5 -0
  258. package/src/unzip.ts +2 -0
@@ -1,132 +1,112 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
6
-
7
- var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
8
-
9
- var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
10
-
11
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
12
-
13
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
14
-
15
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
16
-
17
- var LRU = require('quick-lru');
18
-
19
- var BufferCache =
20
- /*#__PURE__*/
21
- function () {
22
- function BufferCache(_ref) {
23
- var fetch = _ref.fetch,
24
- _ref$size = _ref.size,
25
- size = _ref$size === void 0 ? 10000000 : _ref$size,
26
- _ref$chunkSize = _ref.chunkSize,
27
- chunkSize = _ref$chunkSize === void 0 ? 32768 : _ref$chunkSize;
28
- (0, _classCallCheck2.default)(this, BufferCache);
29
- if (!fetch) throw new Error('fetch function required');
30
- this.fetch = fetch;
31
- this.chunkSize = chunkSize;
32
- this.lruCache = new LRU({
33
- maxSize: Math.floor(size / chunkSize)
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
34
9
  });
35
- }
36
-
37
- (0, _createClass2.default)(BufferCache, [{
38
- key: "get",
39
- value: function () {
40
- var _get = (0, _asyncToGenerator2.default)(
41
- /*#__PURE__*/
42
- _regenerator.default.mark(function _callee(outputBuffer, offset, length, position) {
43
- var _this = this;
44
-
45
- var firstChunk, lastChunk, fetches, _loop, chunk, chunks, chunksOffset;
46
-
47
- return _regenerator.default.wrap(function _callee$(_context) {
48
- while (1) {
49
- switch (_context.prev = _context.next) {
50
- case 0:
51
- if (!(outputBuffer.length < offset + length)) {
52
- _context.next = 2;
53
- break;
54
- }
55
-
56
- throw new Error('output buffer not big enough for request');
57
-
58
- case 2:
59
- // calculate the list of chunks involved in this fetch
60
- firstChunk = Math.floor(position / this.chunkSize);
61
- lastChunk = Math.floor((position + length) / this.chunkSize); // fetch them all as necessary
62
-
63
- fetches = new Array(lastChunk - firstChunk + 1);
64
-
65
- _loop = function _loop(chunk) {
66
- fetches[chunk - firstChunk] = _this._getChunk(chunk).then(function (data) {
67
- return {
68
- data: data,
69
- chunkNumber: chunk
70
- };
71
- });
72
- };
73
-
74
- for (chunk = firstChunk; chunk <= lastChunk; chunk += 1) {
75
- _loop(chunk);
76
- } // stitch together the response buffer using them
77
-
78
-
79
- _context.next = 9;
80
- return _promise.default.all(fetches);
81
-
82
- case 9:
83
- chunks = _context.sent;
84
- chunksOffset = position - chunks[0].chunkNumber * this.chunkSize;
85
- (0, _forEach.default)(chunks).call(chunks, function (_ref2) {
86
- var data = _ref2.data,
87
- chunkNumber = _ref2.chunkNumber;
88
- var chunkPositionStart = chunkNumber * _this.chunkSize;
89
- var copyStart = 0;
90
- var copyEnd = _this.chunkSize;
91
- var copyOffset = offset + (chunkNumber - firstChunk) * _this.chunkSize - chunksOffset;
92
-
93
- if (chunkNumber === firstChunk) {
94
- copyOffset = offset;
95
- copyStart = chunksOffset;
96
- }
97
-
98
- if (chunkNumber === lastChunk) {
99
- copyEnd = position + length - chunkPositionStart;
100
- }
101
-
102
- data.copy(outputBuffer, copyOffset, copyStart, copyEnd);
103
- });
104
-
105
- case 12:
106
- case "end":
107
- return _context.stop();
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
108
32
  }
109
- }
110
- }, _callee, this);
111
- }));
112
-
113
- function get(_x, _x2, _x3, _x4) {
114
- return _get.apply(this, arguments);
115
- }
116
-
117
- return get;
118
- }()
119
- }, {
120
- key: "_getChunk",
121
- value: function _getChunk(chunkNumber) {
122
- var cachedPromise = this.lruCache.get(chunkNumber);
123
- if (cachedPromise) return cachedPromise;
124
- var freshPromise = this.fetch(chunkNumber * this.chunkSize, this.chunkSize);
125
- this.lruCache.set(chunkNumber, freshPromise);
126
- return freshPromise;
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ var quick_lru_1 = __importDefault(require("quick-lru"));
43
+ var BufferCache = /** @class */ (function () {
44
+ function BufferCache(_a) {
45
+ var fetch = _a.fetch, _b = _a.size, size = _b === void 0 ? 10000000 : _b, _c = _a.chunkSize, chunkSize = _c === void 0 ? 32768 : _c;
46
+ if (!fetch) {
47
+ throw new Error('fetch function required');
48
+ }
49
+ this.fetch = fetch;
50
+ this.chunkSize = chunkSize;
51
+ this.lruCache = new quick_lru_1.default({ maxSize: Math.floor(size / chunkSize) });
127
52
  }
128
- }]);
129
- return BufferCache;
130
- }();
131
-
132
- module.exports = BufferCache;
53
+ BufferCache.prototype.get = function (outputBuffer, offset, length, position) {
54
+ return __awaiter(this, void 0, void 0, function () {
55
+ var firstChunk, lastChunk, fetches, _loop_1, this_1, chunk, chunks, chunksOffset;
56
+ var _this = this;
57
+ return __generator(this, function (_a) {
58
+ switch (_a.label) {
59
+ case 0:
60
+ if (outputBuffer.length < offset + length) {
61
+ throw new Error('output buffer not big enough for request');
62
+ }
63
+ firstChunk = Math.floor(position / this.chunkSize);
64
+ lastChunk = Math.floor((position + length) / this.chunkSize);
65
+ fetches = new Array(lastChunk - firstChunk + 1);
66
+ _loop_1 = function (chunk) {
67
+ fetches[chunk - firstChunk] = this_1._getChunk(chunk).then(function (data) { return ({
68
+ data: data,
69
+ chunkNumber: chunk,
70
+ }); });
71
+ };
72
+ this_1 = this;
73
+ for (chunk = firstChunk; chunk <= lastChunk; chunk += 1) {
74
+ _loop_1(chunk);
75
+ }
76
+ return [4 /*yield*/, Promise.all(fetches)];
77
+ case 1:
78
+ chunks = _a.sent();
79
+ chunksOffset = position - chunks[0].chunkNumber * this.chunkSize;
80
+ chunks.forEach(function (_a) {
81
+ var data = _a.data, chunkNumber = _a.chunkNumber;
82
+ var chunkPositionStart = chunkNumber * _this.chunkSize;
83
+ var copyStart = 0;
84
+ var copyEnd = _this.chunkSize;
85
+ var copyOffset = offset + (chunkNumber - firstChunk) * _this.chunkSize - chunksOffset;
86
+ if (chunkNumber === firstChunk) {
87
+ copyOffset = offset;
88
+ copyStart = chunksOffset;
89
+ }
90
+ if (chunkNumber === lastChunk) {
91
+ copyEnd = position + length - chunkPositionStart;
92
+ }
93
+ data.copy(outputBuffer, copyOffset, copyStart, copyEnd);
94
+ });
95
+ return [2 /*return*/];
96
+ }
97
+ });
98
+ });
99
+ };
100
+ BufferCache.prototype._getChunk = function (chunkNumber) {
101
+ var cachedPromise = this.lruCache.get(chunkNumber);
102
+ if (cachedPromise) {
103
+ return cachedPromise;
104
+ }
105
+ var freshPromise = this.fetch(chunkNumber * this.chunkSize, this.chunkSize);
106
+ this.lruCache.set(chunkNumber, freshPromise);
107
+ return freshPromise;
108
+ };
109
+ return BufferCache;
110
+ }());
111
+ exports.default = BufferCache;
112
+ //# sourceMappingURL=bufferCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bufferCache.js","sourceRoot":"","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C5B,IAAI,CAAC,SAAS,CACf,CAAA;QACD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;QAC5C,OAAO,YAAY,CAAA;IACrB,CAAC;IACH,kBAAC;AAAD,CAAC,AA/DD,IA+DC"}
@@ -0,0 +1,5 @@
1
+ import LocalFile from "./localFile";
2
+ import RemoteFile from "./remoteFile";
3
+ export function fromUrl(source: any): RemoteFile | LocalFile;
4
+ export function open(maybeUrl: any, maybePath: any, maybeFilehandle: any): any;
5
+ export { LocalFile, RemoteFile };
package/dist/io/index.js CHANGED
@@ -1,31 +1,33 @@
1
1
  "use strict";
2
-
3
- var url = require('url');
4
-
5
- var RemoteFile = require('./remoteFile');
6
-
7
- var LocalFile = require('./localFile');
8
-
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.open = exports.fromUrl = exports.RemoteFile = exports.LocalFile = void 0;
7
+ var url_1 = __importDefault(require("url"));
8
+ var remoteFile_1 = __importDefault(require("./remoteFile"));
9
+ exports.RemoteFile = remoteFile_1.default;
10
+ var localFile_1 = __importDefault(require("./localFile"));
11
+ exports.LocalFile = localFile_1.default;
9
12
  function fromUrl(source) {
10
- var _url$parse = url.parse(source),
11
- protocol = _url$parse.protocol,
12
- pathname = _url$parse.pathname;
13
-
14
- if (protocol === 'file:') {
15
- return new LocalFile(unescape(pathname));
16
- }
17
-
18
- return new RemoteFile(source);
13
+ var _a = url_1.default.parse(source), protocol = _a.protocol, pathname = _a.pathname;
14
+ if (protocol === 'file:') {
15
+ return new localFile_1.default(unescape(pathname));
16
+ }
17
+ return new remoteFile_1.default(source);
19
18
  }
20
-
21
- module.exports = {
22
- LocalFile: LocalFile,
23
- RemoteFile: RemoteFile,
24
- fromUrl: fromUrl,
25
- open: function open(maybeUrl, maybePath, maybeFilehandle) {
26
- if (maybeFilehandle) return maybeFilehandle;
27
- if (maybeUrl) return fromUrl(maybeUrl);
28
- if (maybePath) return new LocalFile(maybePath);
19
+ exports.fromUrl = fromUrl;
20
+ function open(maybeUrl, maybePath, maybeFilehandle) {
21
+ if (maybeFilehandle) {
22
+ return maybeFilehandle;
23
+ }
24
+ if (maybeUrl) {
25
+ return fromUrl(maybeUrl);
26
+ }
27
+ if (maybePath) {
28
+ return new localFile_1.default(maybePath);
29
+ }
29
30
  throw new Error('no url, path, or filehandle provided, cannot open');
30
- }
31
- };
31
+ }
32
+ exports.open = open;
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/io/index.js"],"names":[],"mappings":";;;;;;AAAA,4CAAqB;AACrB,4DAAqC;AAwBjB,qBAxBb,oBAAU,CAwBa;AAvB9B,0DAAmC;AAuB1B,oBAvBF,mBAAS,CAuBE;AArBlB,SAAS,OAAO,CAAC,MAAM;IACf,IAAA,KAAyB,aAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAxC,QAAQ,cAAA,EAAE,QAAQ,cAAsB,CAAA;IAChD,IAAI,QAAQ,KAAK,OAAO,EAAE;QACxB,OAAO,IAAI,mBAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAA;KACzC;IACD,OAAO,IAAI,oBAAU,CAAC,MAAM,CAAC,CAAA;AAC/B,CAAC;AAe+B,0BAAO;AAbvC,SAAS,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,eAAe;IAChD,IAAI,eAAe,EAAE;QACnB,OAAO,eAAe,CAAA;KACvB;IACD,IAAI,QAAQ,EAAE;QACZ,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAA;KACzB;IACD,IAAI,SAAS,EAAE;QACb,OAAO,IAAI,mBAAS,CAAC,SAAS,CAAC,CAAA;KAChC;IACD,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;AACtE,CAAC;AAEwC,oBAAI"}
@@ -0,0 +1,10 @@
1
+ export default class LocalFile {
2
+ constructor(source: any);
3
+ position: number;
4
+ filename: any;
5
+ fd: any;
6
+ read(buffer: any, offset: number | undefined, length: any, position: any): Promise<any>;
7
+ readFile(): Promise<any>;
8
+ stat(): Promise<any>;
9
+ _stat: any;
10
+ }
@@ -1,165 +1,108 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
6
-
7
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
8
-
9
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
10
-
11
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
12
-
13
- var _require = require('es6-promisify'),
14
- promisify = _require.promisify; // don't load fs native module if running in webpacked code
15
-
16
-
17
- var fs = typeof __webpack_require__ !== 'function' ? require('fs') : null; // eslint-disable-line camelcase
18
-
19
- var fsOpen = fs && promisify(fs.open);
20
- var fsRead = fs && promisify(fs.read);
21
- var fsFStat = fs && promisify(fs.fstat);
22
- var fsReadFile = fs && promisify(fs.readFile);
23
-
24
- var LocalFile =
25
- /*#__PURE__*/
26
- function () {
27
- function LocalFile(source) {
28
- (0, _classCallCheck2.default)(this, LocalFile);
29
- this.position = 0;
30
- this.filename = source;
31
- this.fd = fsOpen(this.filename, 'r');
32
- }
33
-
34
- (0, _createClass2.default)(LocalFile, [{
35
- key: "read",
36
- value: function () {
37
- var _read = (0, _asyncToGenerator2.default)(
38
- /*#__PURE__*/
39
- _regenerator.default.mark(function _callee(buffer) {
40
- var offset,
41
- length,
42
- position,
43
- readPosition,
44
- _args = arguments;
45
- return _regenerator.default.wrap(function _callee$(_context) {
46
- while (1) {
47
- switch (_context.prev = _context.next) {
48
- case 0:
49
- offset = _args.length > 1 && _args[1] !== undefined ? _args[1] : 0;
50
- length = _args.length > 2 ? _args[2] : undefined;
51
- position = _args.length > 3 ? _args[3] : undefined;
52
- readPosition = position;
53
-
54
- if (readPosition === null) {
55
- readPosition = this.position;
56
- this.position += length;
57
- }
58
-
59
- _context.t0 = fsRead;
60
- _context.next = 8;
61
- return this.fd;
62
-
63
- case 8:
64
- _context.t1 = _context.sent;
65
- _context.t2 = buffer;
66
- _context.t3 = offset;
67
- _context.t4 = length;
68
- _context.t5 = position;
69
- return _context.abrupt("return", (0, _context.t0)(_context.t1, _context.t2, _context.t3, _context.t4, _context.t5));
70
-
71
- case 14:
72
- case "end":
73
- return _context.stop();
74
- }
75
- }
76
- }, _callee, this);
77
- }));
78
-
79
- function read(_x) {
80
- return _read.apply(this, arguments);
81
- }
82
-
83
- return read;
84
- }()
85
- }, {
86
- key: "readFile",
87
- value: function () {
88
- var _readFile = (0, _asyncToGenerator2.default)(
89
- /*#__PURE__*/
90
- _regenerator.default.mark(function _callee2() {
91
- return _regenerator.default.wrap(function _callee2$(_context2) {
92
- while (1) {
93
- switch (_context2.prev = _context2.next) {
94
- case 0:
95
- _context2.t0 = fsReadFile;
96
- _context2.next = 3;
97
- return this.fd;
98
-
99
- case 3:
100
- _context2.t1 = _context2.sent;
101
- return _context2.abrupt("return", (0, _context2.t0)(_context2.t1));
102
-
103
- case 5:
104
- case "end":
105
- return _context2.stop();
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
106
32
  }
107
- }
108
- }, _callee2, this);
109
- }));
110
-
111
- function readFile() {
112
- return _readFile.apply(this, arguments);
113
- }
114
-
115
- return readFile;
116
- }()
117
- }, {
118
- key: "stat",
119
- value: function () {
120
- var _stat = (0, _asyncToGenerator2.default)(
121
- /*#__PURE__*/
122
- _regenerator.default.mark(function _callee3() {
123
- return _regenerator.default.wrap(function _callee3$(_context3) {
124
- while (1) {
125
- switch (_context3.prev = _context3.next) {
126
- case 0:
127
- if (this._stat) {
128
- _context3.next = 8;
129
- break;
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ var es6_promisify_1 = require("es6-promisify");
43
+ var fs_1 = __importDefault(require("fs"));
44
+ var fsOpen = fs_1.default && (0, es6_promisify_1.promisify)(fs_1.default.open);
45
+ var fsRead = fs_1.default && (0, es6_promisify_1.promisify)(fs_1.default.read);
46
+ var fsFStat = fs_1.default && (0, es6_promisify_1.promisify)(fs_1.default.fstat);
47
+ var fsReadFile = fs_1.default && (0, es6_promisify_1.promisify)(fs_1.default.readFile);
48
+ var LocalFile = /** @class */ (function () {
49
+ function LocalFile(source) {
50
+ this.position = 0;
51
+ this.filename = source;
52
+ this.fd = fsOpen(this.filename, 'r');
53
+ }
54
+ LocalFile.prototype.read = function (buffer, offset, length, position) {
55
+ if (offset === void 0) { offset = 0; }
56
+ return __awaiter(this, void 0, void 0, function () {
57
+ var readPosition, _a;
58
+ return __generator(this, function (_b) {
59
+ switch (_b.label) {
60
+ case 0:
61
+ readPosition = position;
62
+ if (readPosition === null) {
63
+ readPosition = this.position;
64
+ this.position += length;
65
+ }
66
+ _a = fsRead;
67
+ return [4 /*yield*/, this.fd];
68
+ case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent(), buffer, offset, length, position])];
130
69
  }
131
-
132
- _context3.t0 = fsFStat;
133
- _context3.next = 4;
134
- return this.fd;
135
-
136
- case 4:
137
- _context3.t1 = _context3.sent;
138
- _context3.next = 7;
139
- return (0, _context3.t0)(_context3.t1);
140
-
141
- case 7:
142
- this._stat = _context3.sent;
143
-
144
- case 8:
145
- return _context3.abrupt("return", this._stat);
146
-
147
- case 9:
148
- case "end":
149
- return _context3.stop();
150
- }
151
- }
152
- }, _callee3, this);
153
- }));
154
-
155
- function stat() {
156
- return _stat.apply(this, arguments);
157
- }
158
-
159
- return stat;
160
- }()
161
- }]);
162
- return LocalFile;
163
- }();
164
-
165
- module.exports = LocalFile;
70
+ });
71
+ });
72
+ };
73
+ LocalFile.prototype.readFile = function () {
74
+ return __awaiter(this, void 0, void 0, function () {
75
+ var _a;
76
+ return __generator(this, function (_b) {
77
+ switch (_b.label) {
78
+ case 0:
79
+ _a = fsReadFile;
80
+ return [4 /*yield*/, this.fd];
81
+ case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
82
+ }
83
+ });
84
+ });
85
+ };
86
+ LocalFile.prototype.stat = function () {
87
+ return __awaiter(this, void 0, void 0, function () {
88
+ var _a, _b;
89
+ return __generator(this, function (_c) {
90
+ switch (_c.label) {
91
+ case 0:
92
+ if (!!this._stat) return [3 /*break*/, 3];
93
+ _a = this;
94
+ _b = fsFStat;
95
+ return [4 /*yield*/, this.fd];
96
+ case 1: return [4 /*yield*/, _b.apply(void 0, [_c.sent()])];
97
+ case 2:
98
+ _a._stat = _c.sent();
99
+ _c.label = 3;
100
+ case 3: return [2 /*return*/, this._stat];
101
+ }
102
+ });
103
+ });
104
+ };
105
+ return LocalFile;
106
+ }());
107
+ exports.default = LocalFile;
108
+ //# sourceMappingURL=localFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localFile.js","sourceRoot":"","sources":["../../src/io/localFile.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAyC;AACzC,0CAAmB;AAEnB,IAAM,MAAM,GAAG,YAAE,IAAI,IAAA,yBAAS,EAAC,YAAE,CAAC,IAAI,CAAC,CAAA;AACvC,IAAM,MAAM,GAAG,YAAE,IAAI,IAAA,yBAAS,EAAC,YAAE,CAAC,IAAI,CAAC,CAAA;AACvC,IAAM,OAAO,GAAG,YAAE,IAAI,IAAA,yBAAS,EAAC,YAAE,CAAC,KAAK,CAAC,CAAA;AACzC,IAAM,UAAU,GAAG,YAAE,IAAI,IAAA,yBAAS,E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BufferCache;
6
+ _fetch(position: any, length: any): Promise<Buffer>;
7
+ _stat: {
8
+ size: number;
9
+ } | undefined;
10
+ read(buffer: any, offset?: number, length?: number, position?: number): Promise<void>;
11
+ readFile(): Promise<Buffer>;
12
+ stat(): Promise<{
13
+ size: number;
14
+ }>;
15
+ }
16
+ import BufferCache from "./bufferCache";