Skip to content

cyclic-software/starter-s3-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Starter S3 Storage

This sample shows a basic GET/PUT/DELETE app interacting with Cyclic S3 support.

Docs

To learn more check out the Cyclic Docs

If you have questions or need help find us on discord server.

Usage

export APP_URL='https://some-app.cyclic.app'

curl -i -XPUT --data '{"k1":"value 1", "k2": "value 2"}' -H "Content-type: application/json" "$APP_URL/myFile.txt"

curl -i "$APP_URL/myFile.txt"

curl -i -XDELETE "$APP_URL/myFile.txt"

Local Access

(async () => {
  // Store something
  await s3.putObject({
    Body: JSON.stringify({"now":new Date().toString()}),
    Bucket: process.env.BUCKET,
    Key: "some_files/my_file.json",
  }).promise()

  // Read the file
  let my_file = await s3.getObject({
    Bucket: process.env.BUCKET,
    Key: "some_files/my_file.json",
  }).promise()

  // Log file content
  console.log(JSON.parse(my_file.Body.toString()))

  let res = await s3.deleteObject({
    Bucket: process.env.BUCKET,
    Key: "some_files/my_file.json",
  }).promise()

  console.log(res)
})()

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published