-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding file upload tool for storing assets into S3 and adding DZI con…
…version support to the data-formatting tool
- Loading branch information
Showing
7 changed files
with
133 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
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 |
---|---|---|
|
@@ -2,4 +2,5 @@ markdown==3.6 | |
jupyter==1.0.0 | ||
Flask==3.0.3 | ||
python-dotenv==1.0.1 | ||
matplotlib==3.9.0 | ||
matplotlib==3.9.1 | ||
pyvips==2.2.3 |
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,5 @@ | ||
ASSET_STORE_ACCESS_KEY= | ||
ASSET_STORE_SECRET_KEY= | ||
ASSET_STORE_USE_SSL= | ||
ASSET_STORE_END_POINT= | ||
ASSET_STORE_PORT= |
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,19 @@ | ||
{ | ||
"name": "upload-file", | ||
"version": "1.0.0", | ||
"description": "Utility for uploading files to Minio asset storage", | ||
"main": "upload-file.js", | ||
"scripts": { | ||
"start": "node upload-file.js" | ||
}, | ||
"dependencies": { | ||
"dotenv": "latest", | ||
"minio": "latest", | ||
"prompt": "latest" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/dsi-icl/next-ove.git" | ||
}, | ||
"private": true | ||
} |
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,42 @@ | ||
const prompt = require('prompt'); | ||
const dotenv = require('dotenv'); | ||
const Minio = require('minio'); | ||
|
||
dotenv.config(); | ||
|
||
const s3 = new Minio.Client({ | ||
endPoint: process.env.ASSET_STORE_END_POINT, | ||
port: parseInt(process.env.ASSET_STORE_PORT), | ||
useSSL: process.env.ASSET_STORE_USE_SSL === 'true', | ||
accessKey: process.env.ASSET_STORE_ACCESS_KEY, | ||
secretKey: process.env.ASSET_STORE_SECRET_KEY | ||
}); | ||
|
||
/** @type { () => Promise<{objectName: string, filePath: string | null | undefined, projectTitle: string}> } */ | ||
const getDetails = () => { | ||
prompt.start(); | ||
prompt.message = 'Enter project title, the object\'s name and the file\'s path:\n'; | ||
prompt.delimiter = ''; | ||
return prompt.get({ | ||
properties: { | ||
projectTitle: { | ||
message: 'project title:', | ||
required: true | ||
}, | ||
objectName: { | ||
message: 'object name:', | ||
required: true | ||
}, | ||
filePath: { | ||
message: 'file path:' | ||
} | ||
} | ||
}); | ||
}; | ||
|
||
const run = async () => { | ||
const { projectTitle, objectName, filePath } = await getDetails(); | ||
s3.fPutObject(projectTitle, objectName, filePath === null || filePath === undefined ? objectName : filePath).catch(console.error); | ||
}; | ||
|
||
run().catch(console.error); |