-
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.
- Loading branch information
1 parent
fb6bb1a
commit 182e4b5
Showing
1 changed file
with
45 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const path = require("path"); | ||
process.chdir(path.join(__dirname,"../")); | ||
require("rootpath")(); | ||
require("dotenv").config(); | ||
const { stow } = require("../api/dicom-web/stow/service/stow"); | ||
const os = require("os"); | ||
const { program } = require("commander"); | ||
|
||
let osPlatform = os.platform().toLocaleLowerCase(); | ||
if (osPlatform.includes("linux")) { | ||
process.env.ENV = "linux"; | ||
} else if (osPlatform.includes("win")) { | ||
process.env.ENV = "windows"; | ||
} | ||
|
||
program.requiredOption("-f, --file <string>", "The DICOM file that need to upload"); | ||
program.parse(); | ||
|
||
const options = program.opts(); | ||
|
||
let filePath = options.file; | ||
async function main() { | ||
console.log(`input file: ${filePath}`); | ||
|
||
let storeInstanceResult = await stow( | ||
{ | ||
headers: { | ||
host: "localhost:8081" | ||
} | ||
}, | ||
filePath | ||
); | ||
|
||
if (storeInstanceResult.isFailure) { | ||
console.error(storeInstanceResult.message); | ||
process.exit(1); | ||
} | ||
|
||
console.log(storeInstanceResult.message); | ||
process.exit(0); | ||
} | ||
|
||
( async () => { | ||
await main(); | ||
})(); |