Storage service constructor. Properties of options object depend on the storage service provider.
Name | Type | Description |
---|---|---|
options |
Object
|
Options to create a provider; see below. |
Name | Type | Description |
---|---|---|
provider |
String
|
Storage service provider. Must be one of:
Other supported values depend on the provider. See the documentation for more information. |
Create a new storage service container.
Name | Type | Description |
---|---|---|
options |
Object
|
Options to create a container. Option properties depend on the provider. |
cb |
Function
|
Callback function |
Name | Type | Description |
---|---|---|
name |
String
|
Container name |
Optional callback. When the callback function is not provided, a promise is returned instead (see below).
Name | Type | Description |
---|---|---|
err |
Object or String
|
Error string or object |
container |
Object
|
Container metadata object |
This method supports both callback-based and promise-based invocation. Call this method with no callback argument to get back a promise instead.
Handler | Argument | Description |
---|---|---|
resolve |
Object
|
Container metadata object |
Destroy an existing storage service container.
Name | Type | Description |
---|---|---|
container |
String
|
Container name. |
callback |
Function
|
Callback function. |
Optional callback. When the callback function is not provided, a promise is returned instead (see below).
Name | Type | Description |
---|---|---|
err |
Object or String
|
Error string or object |
This method supports both callback-based and promise-based invocation. Call this method with no callback argument to get back a promise instead.
Handler | Argument | Description |
---|---|---|
resolve |
undefined
|
The resolve handler does not receive any arguments. |
Download middleware
Name | Type | Description |
---|---|---|
container |
String
|
Container name |
file |
String
|
File name |
req |
Request
|
HTTP request |
res |
Response
|
HTTP response |
cb |
Function
|
Callback function |
This method supports both callback-based and promise-based invocation. Call this method with no callback argument to get back a promise instead.
Handler | Argument | Description |
---|---|---|
resolve |
Get the stream for downloading.
Name | Type | Description |
---|---|---|
container |
String
|
Container name. |
file |
String
|
File name. |
options |
Object
|
Options for downloading |
Name | Type | Description |
---|---|---|
result |
Stream
|
Stream for downloading |
Look up a container metadata object by name.
Name | Type | Description |
---|---|---|
container |
String
|
Container name. |
callback |
Function
|
Callback function. |
Optional callback. When the callback function is not provided, a promise is returned instead (see below).
Name | Type | Description |
---|---|---|
err |
Object or String
|
Error string or object |
container |
Object
|
Container metadata object |
This method supports both callback-based and promise-based invocation. Call this method with no callback argument to get back a promise instead.
Handler | Argument | Description |
---|---|---|
resolve |
Object
|
Container metadata object |
List all storage service containers.
Name | Type | Description |
---|---|---|
callback |
Function
|
Callback function |
Optional callback. When the callback function is not provided, a promise is returned instead (see below).
Name | Type | Description |
---|---|---|
err |
Object or String
|
Error string or object |
containers |
Array.<Object>
|
An array of container metadata objects |
This method supports both callback-based and promise-based invocation. Call this method with no callback argument to get back a promise instead.
Handler | Argument | Description |
---|---|---|
resolve |
Array.<Object>
|
An array of container metadata objects |
Look up the metadata object for a file by name
Name | Type | Description |
---|---|---|
container |
String
|
Container name |
file |
String
|
File name |
cb |
Function
|
Callback function |
Optional callback. When the callback function is not provided, a promise is returned instead (see below).
Name | Type | Description |
---|---|---|
err |
Object or String
|
Error string or object |
file |
Object
|
File metadata object |
This method supports both callback-based and promise-based invocation. Call this method with no callback argument to get back a promise instead.
Handler | Argument | Description |
---|---|---|
resolve |
Object
|
File metadata object |
List all files within the given container.
Name | Type | Description |
---|---|---|
container |
String
|
Container name. |
[options] |
Object
|
Options for download |
cb |
Function
|
Callback function |
Optional callback. When the callback function is not provided, a promise is returned instead (see below).
Name | Type | Description |
---|---|---|
err |
Object or String
|
Error string or object |
files |
Array.<Object>
|
An array of file metadata objects |
This method supports both callback-based and promise-based invocation. Call this method with no callback argument to get back a promise instead.
Handler | Argument | Description |
---|---|---|
resolve |
Array.<Object>
|
An array of file metadata objects |
Remove an existing file
Name | Type | Description |
---|---|---|
container |
String
|
Container name |
file |
String
|
File name |
cb |
Function
|
Callback function |
Optional callback. When the callback function is not provided, a promise is returned instead (see below).
Name | Type | Description |
---|---|---|
err |
Object or String
|
Error string or object |
This method supports both callback-based and promise-based invocation. Call this method with no callback argument to get back a promise instead.
Handler | Argument | Description |
---|---|---|
resolve |
undefined
|
The resolve handler does not receive any arguments. |
Upload middleware for the HTTP request/response
Name | Type | Description |
---|---|---|
[container] |
String
|
Container name |
req |
Request
|
Request object |
res |
Response
|
Response object |
[options] |
Object
|
Options for upload |
cb |
Function
|
Callback function |
This method supports both callback-based and promise-based invocation. Call this method with no callback argument to get back a promise instead.
Handler | Argument | Description |
---|---|---|
resolve |
Get the stream for uploading
Name | Type | Description |
---|---|---|
container |
String
|
Container name |
file |
String
|
File name |
[options] |
Object
|
Options for uploading |
Name | Type | Description |
---|---|---|
result |
Stream
|
Stream for uploading |
Handle multipart/form-data upload to the storage service
Name | Type | Description |
---|---|---|
provider |
Object
|
The storage service provider |
req |
Request
|
The HTTP request |
res |
Response
|
The HTTP response |
[options] |
Object
|
The container name |
cb |
Function
|
Callback function |
Handle download from a container/file.
Name | Type | Description |
---|---|---|
provider |
Object
|
The storage service provider |
req |
Request
|
The HTTP request |
res |
Response
|
The HTTP response |
container |
String
|
The container name |
file |
String
|
The file name |
cb |
Function
|
Callback function. |