한글뷰어 기능수정 Ver.01
This commit is contained in:
29
scratch_download_hwp.js
Normal file
29
scratch_download_hwp.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const { GetObjectCommand } = require('@aws-sdk/client-s3');
|
||||
const onPremiseClient = require('./config/onPremiseClient.js');
|
||||
const fs = require('fs');
|
||||
|
||||
async function run() {
|
||||
const bucketName = 'pm-test-04';
|
||||
const objectKey = 'archive/origin/01_TEST01_산출물/A/2. 뷰잉 테스트/test_hwpx.hwpx__260616-103002-723';
|
||||
|
||||
console.log(`Downloading ${objectKey} from ${bucketName}...`);
|
||||
try {
|
||||
const command = new GetObjectCommand({
|
||||
Bucket: bucketName,
|
||||
Key: objectKey
|
||||
});
|
||||
const response = await onPremiseClient.send(command);
|
||||
|
||||
// Write to local file
|
||||
const writeStream = fs.createWriteStream('downloaded_test.hwpx');
|
||||
response.Body.pipe(writeStream);
|
||||
|
||||
writeStream.on('finish', () => {
|
||||
console.log('Download finished. File saved as downloaded_test.hwpx');
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Error downloading:', err);
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
Reference in New Issue
Block a user