import { transferUtility } from 'react-native-s3';
Return: Promise - will resolve arguments:
- Boolean -
true
orfalse
depending on the setup successful.
options
Objectregion
String - a S3 Region (default: eu-west-1)access_key
String - the AWS access key IDsecret_key
String - the AWS secret access keysession_token
String - (optional)remember_last_instance
Boolean - keep the last transferUtility instance when JS reload (default: true) (iOS)
Return: Promise - will resolve arguments:
- Boolean -
true
orfalse
depending on the setup successful.
options
Objectregion
String - a S3 Region (default: eu-west-1)identity_pool_id
String - the Amazon Cogntio identity poolcognito_region
String - a Cognito Region (default: eu-west-1)caching
Boolean - useCognitoCachingCredentialsProvider
instead ofCognitoCredentialsProvider
(Android)remember_last_instance
Boolean - keep the last transferUtility instance when JS reload (default: true) (iOS)
See AWS CognitoCredentialsProvider (iOS/Android) for more information.
Return: Promise - will resolve arguments:
- Boolean -
true
orfalse
depending on the setup successful.
- enabled Boolean - Allow
in_progress
event send to JS runtime. (Default: true)
Return: Promise
New a upload task.
options
Object
Return: Promise - will resolve, see following arguments:
- Object - a Task object
or reject.
New a download task.
options
Objectbucket
String - a S3 bucket namekey
String - the object key/destination in the bucketfile
String - donwload save file path
Return: Promise - will resolve, see following arguments:
- Object - a Task object
or reject.
id
Number - a Task id
id
Number - a Task id
id
Number - a Task id
id
Number - a Task id
Return: Promise - will resolve, see following arguments:
- Boolean -
true
orfalse
depending on the delete task record successful.
Gets a Task object with the given id.
id
Number - a Task id
Return: Promise - will resolve, see following arguments:
- Object - a Task object
Gets a Task object list with the type.
type
String - enum:upload
,download
idAsKey
Boolean - true: return Object with id as key, false: return Array
Return: Promise - will resolve, see following arguments:
- Array - a Task object list
Subscribe the task changes with the given id.
id
Number - a Task ideventHandler
Function - arguments:err
Object - error information object or null if no errortask
Object - a Task object
Unsubscribe task change listener eventHandler
with the given id.
If eventHandler
is not exists, it will unsubscribe all task change listeners with the given id.
id
Number - a Task id
{
id: Number,
state: String, // task state
// progress of task: bytes / totalBytes
bytes: Number,
totalBytes: Number,
bucket: String,
key: String
}
It will not be immediately refresh, you must subscribe
or call getTask(id)
to replace it.
waiting
in_progress
paused
canceled
completed
failed