0.0.7 • Published 2 years ago

storage-client v0.0.7

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

storage-client

Installation

npm i storage-client --save

Usage

import StorageClient from 'storage-client'

export default {
  data() {
    return {
      storage_client: null,                          // インスタンス
    }
  },
  created() {
    const serverURL = 'https://example.com'          // サーバーのURL
    const idToken   = ''                             // CognitoIDトークン

    this.storage_client = new StorageClient(serverURL, idToken)
  },
  methods: {
    // ファイルアップロード
    async fileUpload() {
      // ↓fileObject
      // https://developer.mozilla.org/ja/docs/Web/API/File
      const fileName = await this.storage_client.putFile(fileObject)
      }
    },
    // ファイルの認証済みURL取得
    async getPresignedURL() {
      const res = await this.storage_client.getFileUrl(fileName)
      const url = res.data
    },
    // ファイル削除
    fileDelete() {
      const fileName = "ファイル作成に取得したファイル名"
      this.storage_client.deleteFile(fileName)
    },
  },
}
0.0.7

2 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.6

3 years ago

0.0.1

3 years ago