For the complete documentation index, see llms.txt. This page is also available as Markdown.

Access S3 buckets With AWS S3 Client SDK

ตัวอย่างเบื้องต้นสำหรับกาเข้าใช้งาน Object storage (S3) ด้วย NodeJS ผ่าน AWS S3 Client SDK

Prerequisite

Preparing

  • ทำการติดตั้ง Package aws-sdk/client-s3

npm install @aws-sdk/client-s3
package.json

Getting started

Import

  • ทำการ import S3Client และ Command ที่ต้องการใช้งาน

จากตัวอย่างข้างล่างนี้ คือการ import S3Client และ Command ที่ต้องการใช้งานคือ ListBucketsCommand

การทำงานเบื้องต้น

  • ทำการประกาศตัวแปรจาก S3Client เพื่อใช้สำหรับการ configuration และการส่ง request ต่างๆ

  • ทำการประกาศตัวแปรจาก command ที่ต้องการใช้งาน และใส่ parameter ตามความต้องการของ command นั้น

  • เรียกใช้งานคำสั่ง send จาก S3Client เพื่อทำการส่ง request โดยมี command ที่ต้องการใช้งานเป็น parameter

ตัวอย่างการทำงานเบื้องต้น

Last updated