fix-aws-crt

This commit is contained in:
tonyrewin 2022-10-23 09:17:19 +03:00
parent e22fa32894
commit 70535f2366
3 changed files with 1600 additions and 31 deletions

View File

@ -30,6 +30,8 @@
"vercel-build": "astro build"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.194.0",
"aws-crt": "^1.14.5",
"mailgun.js": "^8.0.1"
},
"devDependencies": {

View File

@ -1,14 +1,14 @@
import { createReadStream } from 'fs'
// import { S3Client, type S3ClientConfig, PutObjectCommand } from '@aws-sdk/client-s3'
import { S3Client, type S3ClientConfig, PutObjectCommand } from '@aws-sdk/client-s3'
// const accessKeyId = process.env.ACCESS_KEY
// const secretAccessKey = process.env.SECRET_KEY
const config = {
const config: S3ClientConfig = {
apiVersion: '2006-03-01',
region: 'eu-east-1'
}
// const s3 = new S3Client(config)
const s3 = new S3Client(config)
export default async function handler(req, res) {
const params = {
@ -16,6 +16,6 @@ export default async function handler(req, res) {
Key: 'file-name', // FIXME
Body: createReadStream('file-path') // FIXME
}
// await s3.send(new PutObjectCommand(params))
await s3.send(new PutObjectCommand(params))
res.status(200).json() // FIXME
}

1621
yarn.lock

File diff suppressed because it is too large Load Diff