Skip to content

Commit

Permalink
fix(readImageDicomFileSeries): await if file objects are passed
Browse files Browse the repository at this point in the history
  • Loading branch information
jadh4v authored and thewtex committed Aug 14, 2023
1 parent 03298bd commit 54e3480
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/dicom/typescript/src/read-image-dicom-file-series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ async function readImageDicomFileSeries(
throw new Error('"input-images" option must have a length > 1')
}

options.inputImages.forEach(async (value) => {
await Promise.all(options.inputImages.map(async (value) => {
let valueFile = value
if (value instanceof File) {
const valueBuffer = await value.arrayBuffer()
valueFile = { path: value.name, data: new Uint8Array(valueBuffer) }
}
inputs.push(valueFile as BinaryFile)
})
}))

if (options.singleSortedSeries) {
const taskArgsArray = []
Expand Down
4 changes: 2 additions & 2 deletions src/bindgen/typescript/function-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ function functionModule (srcOutputDir, forNode, interfaceJson, modulePascalCase,
if (forNode) {
functionContent += ` options.${camel}.forEach((value) => {\n`
} else {
functionContent += ` options.${camel}.forEach(async (value) => {\n`
functionContent += ` await Promise.all(options.${camel}.map(async (value) => {\n`
}
if (interfaceJsonTypeToInterfaceType.has(parameter.type)) {
const interfaceType = interfaceJsonTypeToInterfaceType.get(parameter.type)
Expand Down Expand Up @@ -309,7 +309,7 @@ function functionModule (srcOutputDir, forNode, interfaceJson, modulePascalCase,
} else {
functionContent += ' args.push(value.toString())\n\n'
}
functionContent += ' })\n'
functionContent += forNode ? ' })\n' : ' }))\n';
} else {
if (interfaceJsonTypeToInterfaceType.has(parameter.type)) {
const interfaceType = interfaceJsonTypeToInterfaceType.get(parameter.type)
Expand Down

0 comments on commit 54e3480

Please sign in to comment.