-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove pretty json when response
feat: add retrieve single instance bulkdata
- Loading branch information
1 parent
0aa9254
commit 992fe54
Showing
4 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const mongodb = require("../../../models/mongodb"); | ||
const _ = require('lodash'); | ||
const uuid = require('uuid'); | ||
const fs = require('fs'); | ||
|
||
/** | ||
* | ||
* @param {import('express').Request} req | ||
* @param {import('express').Response} res | ||
* @returns | ||
*/ | ||
module.exports = async function (req , res) { | ||
let key = req.params.objKey; | ||
let studyUID = req.params.studyUID; | ||
let seriesUID = req.params.seriesUID; | ||
let instanceUID = req.params.instanceUID; | ||
let metadata = await mongodb["dicomBulkData"].findOne({ | ||
$and: [ | ||
{ | ||
studyUID: studyUID | ||
}, | ||
{ | ||
seriesUID: seriesUID | ||
}, | ||
{ | ||
instanceUID: instanceUID | ||
}, | ||
{ | ||
filename: new RegExp(key , "gi") | ||
} | ||
] | ||
}); | ||
let bulkData = fs.readFileSync(`${process.env.DICOM_STORE_ROOTPATH}${metadata._doc.filename}`); | ||
|
||
const BOUNDARY = `${uuid.v4()}-${uuid.v4()}`; | ||
res.set("Content-Type" , `multipart/related; type=application/octet-stream; boundary=${BOUNDARY}`); | ||
res.write(`--${BOUNDARY}\r\n`); | ||
res.write(`Content-Type:multipart/related; type=application/octet-stream; boundary=${BOUNDARY}\r\n`); | ||
res.write('Content-length: ' + bulkData.length + '\r\n\r\n'); | ||
res.write(bulkData); | ||
res.write(`\r\n--${BOUNDARY}--`); | ||
return res.end(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters