3.0.5 • Published 9 months ago

@oawu/uploader v3.0.5

Weekly downloads
10
License
MIT
Repository
github
Last release
9 months ago

OA's Upload

上傳無上限,不管是 S3 或 GitHub ☁️

說明

針對指定的目錄,將內容上傳至 AWS S3GitHub Pages

安裝

npm install @oawu/uploader

使用

引入 require('@oawu/uploader') 並選擇要上的平台,如下 S3 範例:

  const { S3 } = require('@oawu/uploader')

  const destDir = '/.../dir/'

  const s3 = S3(destDir, {
    bucket: '',
    access: '',
    secret: '',
    region: ''
  })

  s3.execute(step, error => {
    // Error or Success
  })

execute 當有帶入 callback 時,會變成同步,反之則會變成非同步(async)

共用參數

  • destDir ─ 上傳的目錄,此為 必填
  • prefix ─ 前綴路徑,此為 ''
  • ignoreNames ─ 忽略的檔案名稱(主檔名+副檔名),預設 []
  • ignoreExts ─ 忽略的副檔名,預設 []
  • ignoreDirs ─ 忽略的目錄名稱,預設 []

S3 參數

  • bucket ─ S3 的 Bucket 名稱,此為 必填
  • access ─ S3 的 Access Key,此為 必填
  • secret ─ S3 的 Secret Key,此為 必填
  • region ─ S3 的 Region Key,此為 必填
  • option ─ 上傳 S3 時要的參數,可參考 aws-sdk,預設 {}

Github 參數

  • account ─ GitHub 上的帳號,此為 必填
  • repository ─ GitHub 上的倉庫,此為 必填
  • branch ─ GitHub 上的 pages 分支,預設 gh-pages
  • message ─ 紀錄時的文字訊息,預設 🚀 部署!

使用 Github 時,請先確保您的終端機可以正常 Push Git

以下為 GitHub 範例:

  const { GitHub } = require('@oawu/uploader')

  const destDir = '/.../dir/'

  const gitHub = GitHub(destDir, {
    account: '',
    repository: '',
    isDisplay: true
  })

  gitHub.execute(step, error => {
    // Error or Success
  })

step 為每一步驟的 callback,其格式如下:

 async function(string, async function(setter));

setter 格式如下:

{
  total: _ => { }, // 數量
  advance: _ => { }, // 進度
}
3.0.2

10 months ago

3.0.1

10 months ago

3.0.5

9 months ago

3.0.0

10 months ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.13

2 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago