Comparing version 1.0.4 to 1.0.5
@@ -76,3 +76,2 @@ /** | ||
/** Inner function - handles 404 but not 5xx */ | ||
@@ -183,40 +182,1 @@ exports.sendFile = function utils$$sendFile(response, contentType, filenameStub) | ||
} | ||
/** | ||
* Enable logging from a stream. | ||
* E.g. | ||
* stream = fs.createReadStream(filename, {encoding: 'binary'}); | ||
* logChunks(stream); | ||
* | ||
* @param {*} readable - a readable stream. | ||
*/ | ||
async function logChunks(readableStream) { | ||
for await (const data of readableStream) { | ||
console.log(typeof data, data.constructor); | ||
if (typeof data === 'string') { | ||
for (let k = 0; k < data.length; k++) | ||
console.log(`codePointAt(${k}): ${data.codePointAt(k).toString(16)}`); | ||
} | ||
} | ||
} | ||
/** | ||
* Quck and dirty JSON serialization that ignores cycles. | ||
* | ||
* @param {*} o - entity to be serialized. | ||
* @param {number} len - number of string elements to return. | ||
* @returns {string} | ||
*/ | ||
exports.stringify = function _stringify(o, len = 512) { | ||
if (!o) return 'nada'; | ||
let cache = []; | ||
const str = JSON.stringify(o, (key, value) => { | ||
if (typeof value === 'object' && value !== null) { | ||
if (cache.includes(value)) return; | ||
cache.push(value); | ||
} | ||
return value; | ||
}); | ||
cache = null; | ||
return str.slice(0, len); | ||
} |
@@ -40,3 +40,2 @@ /** | ||
//console.log('dcp-rds:utils:download', pathSuffixComponents); | ||
if (!pathSuffixComponents || pathSuffixComponents.length !== 5) | ||
@@ -54,6 +53,2 @@ throw new Error(`Could not parse URL components of ${request.url} (${pathSuffix})`, 'BAD_REQUEST_URL'); | ||
//console.log('\ndcp-rds:utils:download-response', utils.stringify(response)); | ||
//console.log('\ndcp-rds:utils:download-request', utils.stringify(request)); | ||
//console.log('\ndcp-rds:utils:download-query', utils.stringify(query)); | ||
utils.sendContent(response, job, elementType, element); | ||
@@ -60,0 +55,0 @@ return false; |
@@ -39,6 +39,5 @@ /** | ||
var location = utils.getLocation(request); | ||
var methodPath = location.pathname.replace(/\/upload$/, ''); | ||
var methodPath = location.pathname.replace(/\/upload.*$/, ''); | ||
var href = `${location.protocol}//${location.host}${methodPath}/download/jobs/${job}/${elementType}/${element}`; | ||
//console.log(`dcp-rds:utils:upload query ${utils.stringify(query)}\n`); | ||
if (!Object.hasOwnProperty.call(query, 'content')) | ||
@@ -45,0 +44,0 @@ throw new Error('query missing content'); |
{ | ||
"name": "dcp-rds", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "DCP Remote Data Service reference implementation", | ||
@@ -39,6 +39,6 @@ "scripts": { | ||
"dependencies": { | ||
"kvin": "^1.2.5", | ||
"kvin": "^1.2.6", | ||
"multipart-formdata": "^1.1.0", | ||
"nanoid": "^3.1.29" | ||
"nanoid": "^3.1.30" | ||
} | ||
} |
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
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
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
8
0
49489
15
448
Updatedkvin@^1.2.6
Updatednanoid@^3.1.30