@dsnp/parquetjs
Advanced tools
Comparing version 0.0.0-a8ddc9 to 0.0.0-ba6065
@@ -24,2 +24,3 @@ 'use strict'; | ||
const groupBy = require("lodash/groupBy"); | ||
const fetch = require('cross-fetch'); | ||
const { getBloomFiltersFor, } = bloomFilterReader; | ||
@@ -124,5 +125,5 @@ /** | ||
*/ | ||
static openUrl(request, params, options) { | ||
static openUrl(params, options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let envelopeReader = yield ParquetEnvelopeReader.openUrl(request, params, options); | ||
let envelopeReader = yield ParquetEnvelopeReader.openUrl(params, options); | ||
return this.openEnvelopeReader(envelopeReader, options); | ||
@@ -348,3 +349,3 @@ }); | ||
} | ||
static openUrl(request, params, options) { | ||
static openUrl(params, options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -357,30 +358,16 @@ if (typeof params === 'string') | ||
base = base.slice(0, base.length - 1).join('/') + '/'; | ||
params.encoding = params.encoding || null; | ||
let defaultHeaders = params.headers || {}; | ||
let filesize = () => __awaiter(this, void 0, void 0, function* () { | ||
return new Promise((resolve, reject) => { | ||
let req = request(params); | ||
req.on('response', res => { | ||
req.abort(); | ||
resolve(res.headers['content-length']); | ||
}); | ||
req.on('error', reject); | ||
}); | ||
const { headers } = yield fetch(params.url); | ||
return headers.get('Content-Length'); | ||
}); | ||
let readFn = (offset, length, file) => { | ||
let readFn = (offset, length, file) => __awaiter(this, void 0, void 0, function* () { | ||
let url = file ? base + file : params.url; | ||
let range = `bytes=${offset}-${offset + length - 1}`; | ||
let headers = Object.assign({}, defaultHeaders, { range }); | ||
let req = Object.assign({}, params, { headers, url }); | ||
return new Promise((resolve, reject) => { | ||
request(req, (err, res) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
else { | ||
resolve(res.body); | ||
} | ||
}); | ||
}); | ||
}; | ||
const response = yield fetch(url, { headers }); | ||
const arrayBuffer = yield response.arrayBuffer(); | ||
const buffer = Buffer.from(arrayBuffer); | ||
return buffer; | ||
}); | ||
let closeFn = () => ({}); | ||
@@ -387,0 +374,0 @@ return new ParquetEnvelopeReader(readFn, closeFn, filesize, options); |
@@ -5,4 +5,3 @@ { | ||
"main": "dist/parquet.js", | ||
"types": "dist/parquet.d.ts", | ||
"version": "0.0.0-a8ddc9", | ||
"version": "0.0.0-ba6065", | ||
"homepage": "https://github.com/LibertyDSNP/parquetjs", | ||
@@ -26,2 +25,3 @@ "license": "MIT", | ||
"bson": "^2.0.8", | ||
"cross-fetch": "^3.1.4", | ||
"int53": "^0.2.4", | ||
@@ -47,2 +47,3 @@ "lodash": "^4.17.21", | ||
"mocha": "8.3.2", | ||
"msw": "^0.29.0", | ||
"sinon": "^10.0.0", | ||
@@ -52,3 +53,3 @@ "ts-node": "^9.1.1" | ||
"scripts": { | ||
"build": "tsc -b && tsc -p tsconfig.types.json && cp gen-nodejs/*.d.ts dist/gen-nodejs/", | ||
"build": "tsc -b", | ||
"type": "tsc --noEmit", | ||
@@ -55,0 +56,0 @@ "lint": "echo 'Linting, it is on the TODO list...'", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
606838
18
11
44
8188
2
+ Addedcross-fetch@^3.1.4
+ Addedcross-fetch@3.1.8(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)