mss-nodejs-sdk
mtyun MSS(Meituan Storage Service) sdk for Node.js
install
npm install mos-mss-node6 --save
Overview
Constructs a service interface object. Each API operation is exposed as a function on service.
MSS Usage
MSS, Object Storage Service. Equal to well known Amazon S3.
Constructor Details
Constructs a service object. This object has one method for each API operation.
examples:
var MSS = ; var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>'
options:
- endpoint (String) — The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like '{service}.{region}.amazonaws.com'.
- accessKeyId (String) — your MSS access key ID.
- accessKeySecret (String) — your MSS secret access key.
Method Summary
-
- listBucket()
- createBucket(name[, options])
- deleteBucket(name[, options])
- getBucketACL(name[, options])
- putBucketACL(name, ACL[, options])
- getBucket(name[, options])
- getBucketLifecycle(name[, options])
- putBucketLifecycle(name[, options])
- deleteBucketLifecycle(name,[ options])
- getBucketPolicy(name[, options])
- putBucketPolicy(name[, options])
- getBucketCors(name[, options])
- putBucketCors(name[, options])
- deleteBucketCors(name[, options])
-
- putObject(key, file[, options])
- putStream(key, file[, options])
- multipartUpload(key, file[, options])
- closeMultipartUpload(key, uploadId)
- getParts(key, uploadId)
- getObject(key, path[, options])
- getBuffer(key[, options])
- getStream(key[, options])
- listObject([options])
- copyObject(from, to[, options])
- getMeta(key[, options])
- deleteObject(key[, options])
- deleteMultiple(keys[, options])
Bucket Operations
listBucket()
Returns a list of all buckets owned by the authenticated sender of the request.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>'; var result = client;result;
Parameters:
- query (Object) (defaults to: {})
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. The data object has the following properties:- Buckets (Array)
- Name — (String) The name of the bucket.
- CreationDate — (Date) Date the bucket was created.
- Owner (Object)
- DisplayName — (String)
- ID — (String)
- Buckets (Array)
- error (Object) — the error object returned from the request. Set to
null
if the request is successful.
createBucket(name[, options])
Creates a new bucket.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>'; var result = client;result;
Parameters:
- name (String) Bucket name
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. The data object has the following properties:- x-mss-trace-id (String)
- error (Object) — the error object returned from the request. Set to
null
if the request is successful.
deleteBucket(name[, options])
Deletes the bucket. All objects (including all object versions and Delete Markers) in the bucket must be deleted before the bucket itself can be deleted.
Examples:
var MSS = ; var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>'; var result = client;result;
Parameters:
- name (String) Bucket name
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. - error (Object) — the error object returned from the request. Set to
null
if the request is successful.
getBucketACL(name[, options])
Gets the access control policy for the bucket.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>'; var result = client;result;
Parameters:
- name (String) Bucket name
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. The data object has the following properties:- Owner (Object)
- DisplayName — (String) Screen name of the grantee.
- ID — (String) The canonical user ID of the grantee.
- Grants — (Array) A list of grants.
- Grantee
- DisplayName — (String) Screen name of the grantee.
- EmailAddress — (String) Email address of the grantee.
- ID — (String) The canonical user ID of the grantee.
- URI — (String) URI of the grantee group.
- Permission — (String) Specifies the permission given to the grantee. Possible values include:
- "FULL_CONTROL"
- "WRITE"
- "WRITE_ACP"
- "READ"
- "READ_ACP"
- Grantee
- error (Object) — the error object returned from the request. Set to
null
if the request is successful.
putBucketACL(name, ACl[, options])
Sets the permissions on a bucket using access control lists (ACL).
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>'; var result = client;result;
Parameters:
- name (String) Bucket name.
- ACL — (String) The canned ACL to apply to the bucket. Possible values include:
- private
- public-read
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. - error (Object) — the error object returned from the request. Set to
null
if the request is successful.
getBucket(name[, options])
This operation is useful to determine if a bucket exists and you have permission to access it.mos
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>'; var result = client;result;
Parameters:
- name (String) Bucket name.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. - error (Object) — the error object returned from the request. Set to
null
if the request is successful.
getBucketLifecycle(name[, options])
Get the bucket object lifecycle.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>'; var result = client;result;
Parameters:
- name (String) Bucket name.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:
- Rule — (Array)
- Expiration — (map)
- Date — (Date) Indicates at what date the object is to be moved or deleted. Should be in GMT ISO 8601 Format.
- Days — (Integer) Indicates the lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer.
- ExpiredObjectDeleteMarker — (Boolean) Indicates whether mos S3 will remove a delete marker with no noncurrent versions. If set to true, the delete marker will be expired; if set to false the policy takes no action. This cannot be specified with Days or Date in a Lifecycle Expiration Policy.
- ID — (String) Unique identifier for the rule. The value cannot be longer than 255 characters.
- Prefix — required — (String) Prefix identifying one or more objects to which the rule applies.
- Status — required — (String) If 'Enabled', the rule is currently being applied. If 'Disabled', the rule is not currently being applied. Possible values include:
- "Enabled"
- "Disabled"
- Transition — (map)
- Date — (Date) Indicates at what date the object is to be moved or deleted. Should be in GMT ISO 8601 Format.
- Days — (Integer) Indicates the lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer.
- StorageClass — (String) The class of storage used to store the object. Possible values include:
- "GLACIER"
- "STANDARD_IA"
- NoncurrentVersionTransition — (map) Container for the transition rule that describes when noncurrent objects transition to the STANDARD_IA or GLACIER storage class. If your bucket is versioning-enabled (or versioning is suspended), you can set this action to request that mos S3 transition noncurrent object versions to the STANDARD_IA or GLACIER storage class at a specific period in the object's lifetime.
- NoncurrentDays — (Integer) Specifies the number of days an object is noncurrent before mos S3 can perform the associated action. For information about the noncurrent days calculations, see How mos S3 Calculates When an Object Became Noncurrent in the mos Simple Storage Service Developer Guide.
- StorageClass — (String) The class of storage used to store the object. Possible values include:
- "GLACIER"
- "STANDARD_IA"
- NoncurrentVersionExpiration — (map) Specifies when noncurrent object versions expire. Upon expiration, mos S3 permanently deletes the noncurrent object versions. You set this lifecycle configuration action on a bucket that has versioning enabled (or suspended) to request that mos S3 delete noncurrent object versions at a specific period in the object's lifetime.
- NoncurrentDays — (Integer) Specifies the number of days an object is noncurrent before mos S3 can perform the associated action. For information about the noncurrent days calculations, see How mos S3 Calculates When an Object Became Noncurrent in the mos Simple Storage Service Developer Guide.
- AbortIncompleteMultipartUpload — (map) Specifies the days since the initiation of an Incomplete Multipart Upload that Lifecycle will wait before permanently removing all parts of the upload.
- DaysAfterInitiation — (Integer) Indicates the number of days that must pass since initiation for Lifecycle to abort an Incomplete Multipart Upload.
- Expiration — (map)
- Rule — (Array)
- error (Object) — the error object returned from the request. Set to
null
if the request is successful.
putBucketLifecycle(name[, options])
Set the bucket object lifecycle.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>'; var result = client; result;
Parameters:
- name (String) Bucket name.
- options (Object)
- lifecycleConfiguration — (map)
- Rule — required — (Array)
- Expiration — (map)
- Date — (Date) Indicates at what date the object is to be moved or deleted.Should be in GMT ISO 8601 Format.
- Days — (Integer) Indicates the lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer.
- ExpiredObjectDeleteMarker — (Boolean) Indicates whether mos S3 will remove a delete marker with no noncurrent versions. If set to true, the delete marker will be expired; if set to false the policy takes no action. This cannot be specified with Days or Date in a Lifecycle Expiration Policy.
- ID — (String) Unique identifier for the rule. The value cannot be longer than 255 characters.
- Prefix — required — (String) Prefix identifying one or more objects to which the rule applies.
- Status — required — (String) If 'Enabled', the rule is currently being applied. If 'Disabled', the rule is not currently being applied. Possible values include:
- "Enabled"
- "Disabled"
- Transition — (map)
- Date — (Date) Indicates at what date the object is to be moved or deleted. Should be in GMT ISO 8601 Format.
- Days — (Integer) Indicates the lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer.
- StorageClass — (String) The class of storage used to store the object. Possible values include:
- "GLACIER"
- "STANDARD_IA"
- NoncurrentVersionTransition — (map) Container for the transition rule that describes when noncurrent objects transition to the STANDARD_IA or GLACIER storage class. If your bucket is versioning-enabled (or versioning is suspended), you can set this action to request that mos S3 transition noncurrent object versions to the STANDARD_IA or GLACIER storage class at a specific period in the object's lifetime.
- NoncurrentDays — (Integer) Specifies the number of days an object is noncurrent before mos S3 can perform the associated action. For information about the noncurrent days calculations, see How mos S3 Calculates When an Object Became Noncurrent in the mos Simple Storage Service Developer Guide.
- StorageClass — (String) The class of storage used to store the object. Possible values include:
- "GLACIER"
- "STANDARD_IA"
- NoncurrentVersionExpiration — (map) Specifies when noncurrent object versions expire. Upon expiration, mos S3 permanently deletes the noncurrent object versions. You set this lifecycle configuration action on a bucket that has versioning enabled (or suspended) to request that mos S3 delete noncurrent object versions at a specific period in the object's lifetime.
- NoncurrentDays — (Integer) Specifies the number of days an object is noncurrent before mos S3 can perform the associated action. For information about the noncurrent days calculations, see How mos S3 Calculates When an Object Became Noncurrent in the mos Simple Storage Service Developer Guide.
- AbortIncompleteMultipartUpload — (map) Specifies the days since the initiation of an Incomplete Multipart Upload that Lifecycle will wait before permanently removing all parts of the upload.
- DaysAfterInitiation — (Integer) Indicates the number of days that must pass since initiation for Lifecycle to abort an Incomplete Multipart Upload.
- Expiration — (map)
- Rule — required — (Array)
- lifecycleConfiguration — (map)
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. - error (Object) — the error object returned from the request. Set to
null
if the request is successful.
deleteBucketLifecycle(name[, options])
Deletes the lifecycle configuration from the bucket.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>'; var result = client;result;
Parameters:
- name (String) Bucket name
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. - error (Object) — the error object returned from the request. Set to
null
if the request is successful.
getBucketPolicy(name[, options])
Returns the policy of a specified bucket.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' var result = client;result;
Parameters:
- name (String) Bucket name.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:
- Policy — (String) The bucket policy as a JSON document.
- error (Object) — the error object returned from the request. Set to
null
if the request is successful.
putBucketPolicy(name[, options])
Replaces a policy on a bucket. If the bucket already has a policy, the one in this request completely replaces it.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' var result = client;result;
Parameters:
-
name (String) Bucket name.
-
options (Object)
- policy — (Object) The bucket policy as a JSON document.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. - error (Object) — the error object returned from the request. Set to
null
if the request is successful.
getBucketCors(name[, options])
Returns the cors configuration for the bucket.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>'; var result = client;result;
Parameters:
- name (String) Bucket name.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:
- CORSRule — (Array)
- AllowedHeaders — (Array) Specifies which headers are allowed in a pre-flight OPTIONS request.
- AllowedOrigins — required — (Array) One or more origins you want customers to be able to access the bucket from.
- CORSRule — (Array)
- error (Object) — the error object returned from the request. Set to
null
if the request is successful.
putBucketCors(name[, options])
Sets the cors configuration for a bucket.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>'; var result = client;result;
Parameters:
- name (String) Bucket name.
- options (Object)
- CorsConfiguration — (map)
- CORSRule — required — (Array)
- AllowedHeader — (Array) Specifies which headers are allowed in a pre-flight OPTIONS request.
- AllowedMethod — required — (Array) Identifies HTTP methods that the domain/origin specified in the rule is allowed to execute.
- AllowedOrigin — required — (Array) One or more origins you want customers to be able to access the bucket from.
- MaxAgeSeconds — (Integer) The time in seconds that your browser is to cache the preflight response for the specified resource.
- CORSRule — required — (Array)
- CorsConfiguration — (map)
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) - the de-serialized data returned from the request. The default is
{}
. - error (Object) — the error object returned from the request. Set to
null
if the request is successful.
deleteBucketCors(name[, options])
Deletes the cors configuration information set for the bucket.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>'; var result = client;result;
Parameters:
- name (String) Bucket name.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) - the de-serialized data returned from the request. The default is
{}
. - error (Object) — the error object returned from the request. Set to
null
if the request is successful.
Object Operations
putObject(key, file[, options])
Adds an object to a bucket.
Examples:
// file: Stringvar MSS = ;var path = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var filePath = path;var result = client; result; // file: Buffervar MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var result = client;result;
Parameters:
- key (String) — object name.
- file (String|Buffer|ReadStream) object local path, content buffer or ReadStream content.
- options (Object)
- headers (Object) extra headers.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. The data object has the following properties:- ETag — (String) An ETag is an opaque identifier assigned by a web server to a specific version of a resource found at a URL.
- error (Object) — the error object returned from the request. Set to
null
if the request is successful.
putStream(key, file[, options])
Adds an object to a bucket.
Examples:
var MSS = ;var path = ;var fs = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var filePath = path;var stream = fs; var result = client;result;
Parameters:
- key (String) — object name.
- file (ReadStream) ReadStream content.
- options (Object)
- headers (Object) extra headers.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. The data object has the following properties:- ETag — (String) An ETag is an opaque identifier assigned by a web server to a specific version of a resource found at a URL.
- error (Object) — the error object returned from the request. Set to
null
if the request is successful.
multipartUpload(key, file[, options])
Upload file with MSS multipart.
Examples:
// Piecewise uploadvar MSS = ;var path = ;var fs = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var { return fs;}; var result = client; result; // Breakpoint uploadvar MSS = ;var path = ;var fs = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var { return fs;};var checkpoint = JSON; var object = client; object;
Parameters:
- key (String) — object name.
- file (String) object local path
- options (Object)
- partSize (Number) — the suggested size for each part.
- checkpoint (Object) — the checkpoint to resume upload.
- headers (Object) extra headers.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. The data object has the following properties:- ETag (String) — An ETag is an opaque identifier assigned by a web server to a specific version of a resource found at a URL.
- Location (String)
- Bucket (String)
- Key (String)
- error (Object) — the error object returned from the request. Set to
null
if the request is successful.
closeMultipartUpload(key, uploadId)
Abort a multipart upload for object.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var result = client; result;
Parameters:
- key (String) — object name.
- uploadId (String) the upload id
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. - error (Object) — the error object returned from the request. Set to
null
if the request is successful.
getParts(key, uploadId)
a list of parts that has been uploaded.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var result = client; result;
Parameters:
- key (String) — object name.
- uploadId (String) the upload id
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. - error (Object) — the error object returned from the request. Set to
null
if the request is successful.
getObject(key, path[, options])
Retrieves objects from mos S3.
Examples:
var MSS = ;var path = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var result = client; result;
Parameters:
- key (String) — object name.
- path (String) - object local path.
- options (Object)
- headers (Object) extra headers.
- query (Object)
- response-content-type (String) - Sets the Content-Type header of the response.
- response-content-language (String) - Sets the Content-Language header of the response.
- response-expires (String) - Sets the Expires header of the response.
- response-cache-control (String) - Sets the Cache-Control header of the response.
- response-content-disposition (String) - Sets the Content-Disposition header of the response.
- response-content-encoding (String) - Sets the Content-Encoding header of the response.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. - error (Object) — the error object returned from the request. Set to
null
if the request is successful.
getBuffer(key[, options])
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var result = client; result;
Parameters:
- key (String) — object name.
- options (Object)
- headers (Object) extra headers.
- query (Object)
- response-content-type (String) - Sets the Content-Type header of the response.
- response-content-language (String) - Sets the Content-Language header of the response.
- response-expires (String) - Sets the Expires header of the response.
- response-cache-control (String) - Sets the Cache-Control header of the response.
- response-content-disposition (String) - Sets the Content-Disposition header of the response.
- response-content-encoding (String) - Sets the Content-Encoding header of the response.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. The data object has the following properties:- content (String) — the data.
- error (Object) — the error object returned from the request. Set to
null
if the request is successful.
getStream(key[, options])
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var writeStream = fs; var result = client; result;
Parameters:
- key (String) — object name.
- options (Object)
- headers (Object) extra headers.
- query (Object)
- response-content-type (String) - Sets the Content-Type header of the response.
- response-content-language (String) - Sets the Content-Language header of the response.
- response-expires (String) - Sets the Expires header of the response.
- response-cache-control (String) - Sets the Cache-Control header of the response.
- response-content-disposition (String) - Sets the Content-Disposition header of the response.
- response-content-encoding (String) - Sets the Content-Encoding header of the response.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. The data object has the following properties:- stream (ReadStream)
- error (Object) — the error object returned from the request. Set to
null
if the request is successful.
listObject([options])
Returns all of the objects in a bucket.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var result = client;result;
Parameters:
- key (String) — object name.
- options (Object)
- query (Object) query object, see the api list.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. The data object has the following properties:- Contents (Array) the list of object.
- Key (String) — object name on mss.
- Etag (String) — object etag.
- LastModified (String) — object last modified GMT date.
- Size (Number) — object size.
- StorageClass (String) — storage class type.
- Owner (Object) — object owner, including ID and DisplayName.
- Contents (Array) the list of object.
- error (Object) — the error object returned from the request. Set to
null
if the request is successful.
copyObject(from, to[, options])
Creates a copy of an object that is already stored in mss S3.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var result = client; result;
Parameters:
- key (String) — object name.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. The data object has the following properties:- Etag (String) — object etag.
- LastModified (String) — object last modified GMT date. - error (Object) — the error object returned from the request. Set to
null
if the request is successful.
getMeta(key[, options])
Retrieves objects meta from mos S3.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var result = client;result;
Parameters:
- key (String) — object name.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. The data object has the following properties:- Etag (String) — object etag.
- LastModified (String) — object last modified GMT date.
- ContentType (String) — content-type.
- error (Object) — the error object returned from the request. Set to
null
if the request is successful.
deleteObject(key[, options])
Deletes an object.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var result = client; result;
Parameters:
- key (String) — object name.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. - error (Object) — the error object returned from the request. Set to
null
if the request is successful.
deleteMultiple(keys[, options])
Deletes objects by query.
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var result = client; result;
Parameters:
- keys (Array) — objects.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (Object) — the de-serialized data returned from the request. The default is
{}
. Set to{}
if a request error occurs. - error (Object) — the error object returned from the request. Set to
null
if the request is successful.
signatureUrl(name[, options])
Examples:
var MSS = ;var client = accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' bucket: 'Bucket'; var result = client; result;
Parameters:
- name (String) — object name.
- options (Object)
- headers (Object) extra headers.
- query (Object)
- response-content-type (String) - Sets the Content-Type header of the response.
- response-content-language (String) - Sets the Content-Language header of the response.
- response-expires (String) - Sets the Expires header of the response.
- response-cache-control (String) - Sets the Cache-Control header of the response.
- response-content-disposition (String) - Sets the Content-Disposition header of the response.
- response-content-encoding (String) - Sets the Content-Encoding header of the response.
Return:
- res (Object)
- code (Number) — the code number returned from the request. The request is successful when the number is 200.
- data (String) — object signature url.