qiniu v0.3.4 Qiniu.Uploader

For uploading.

Summary

Functions

upload(put_policy, local_file, opts \\ [])

Upload a file directly. See http://developer.qiniu.com/docs/v6/api/reference/up/upload.html

Example

put_policy = %Qiniu.PutPolicy{scope: "books", deadline: 1427990400}
Qiniu.Uploader.upload put_policy, "~/cool.jpg", key: "cool.jpg"
# =>
%HTTPoison.Response{
  body: "body",
  headers: %{"connection" => "keep-alive", "content-length" => "517", ...},
  status_code: 200
}

Fields

  • put_policy - PutPolicy struct
  • local_file - path of local file

Options

  • :key - file name in a Qiniu bucket
  • :crc32 - crc32 to check the file
  • others - Custom fields atom: "string", e.g. foo: "foo", bar: "bar"