new FileFactory(propertiesopt, …arguments) → {binding.File}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
properties |
Object |
<optional> |
initial properties to set on the file |
arguments |
* |
<repeatable> |
Additional constructor params passed through the type constructor |
- Source:
Returns:
The new managed instance
- Type
- binding.File
Extends
Methods
create(db) → {binding.FileFactory}
Creates a new FileFactory for the given type
Parameters:
Name | Type | Description |
---|---|---|
db |
EntityManager |
- Source:
Returns:
A new file factory
- Type
- binding.FileFactory
fromJSON(json) → {binding.File}
Deserialize the file metadata from a json object back to a new file instance
Parameters:
Name | Type | Description |
---|---|---|
json |
json | The file metadata as json |
- Source:
Returns:
The deserialize File instance
- Type
- binding.File
listBuckets(doneCallbackopt, failCallbackopt) → {Promise.<Array.<binding.File>>}
Lists all the buckets.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
doneCallback |
binding.FileFactory~fileListCallback |
<optional> |
The callback is invoked with the listed buckets |
failCallback |
binding.File~failCallback |
<optional> |
The callback is invoked if any error has occurred |
- Source:
Returns:
The listed buckets.
- Type
- Promise.<Array.<binding.File>>
listFiles(folderOrPath, start, count, doneCallbackopt, failCallbackopt) → {Promise.<Array.<binding.File>>}
Lists the files (and folders) in the given folder.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
folderOrPath |
binding.File | string | The folder/path to list. |
|
start |
binding.File | The file/folder from where to start listing (not included) |
|
count |
number | The maximum number of files to return. |
|
doneCallback |
binding.FileFactory~fileListCallback |
<optional> |
The callback is invoked with the listed files |
failCallback |
binding.File~failCallback |
<optional> |
The callback is invoked if any error has occurred |
- Source:
Returns:
The listed files/folders.
- Type
- Promise.<Array.<binding.File>>
loadMetadata(bucket, optionsopt, doneCallbackopt, failCallbackopt) → {Promise.<Object.<string, util.Permission>>}
Gets the metadata of the root folder (formally the file "bucket")
Parameters:
Name | Type | Attributes | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bucket |
string | The name of the root file directory |
|||||||||||
options |
Object |
<optional> |
The load metadata options |
||||||||||
Properties
|
|||||||||||||
doneCallback |
binding.FileFactory~bucketMetadataCallback |
<optional> |
The callback is invoked after the metadata is fetched |
||||||||||
failCallback |
binding.File~failCallback |
<optional> |
The callback is invoked if any error has occurred |
- Source:
Returns:
A promise which will be fulfilled with the bucket acls
- Type
- Promise.<Object.<string, util.Permission>>
new(fileOptions) → {binding.File}
Creates a new file object which represents the file at the given ID
Data provided to the constructor will be uploaded by invoking upload()
.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fileOptions |
object | string | The fileOptions used to create a new file object, or just the id of the |
|||||||||||||||||||||||||||||||||||||||||||||||||||
Properties
|
- Source:
Returns:
A new file instance
- Type
- binding.File
newInstance(argsopt) → {binding.File}
Creates a new file
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
Array.<*> |
<optional> |
Constructor arguments used for instantiation, the constructor will not be called |
- Source:
Returns:
A new created file
- Type
- binding.File
saveMetadata(bucket, metadata, doneCallbackopt, failCallbackopt) → {Promise.<void>}
Updates the metadata of the root file directory formally the file "bucket"
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bucket |
string | The name of the root file directory |
|||||||||||||||||||||||||
metadata |
Object.<string, util.Permission> | The new metadata for the bucket |
|||||||||||||||||||||||||
Properties
|
|||||||||||||||||||||||||||
doneCallback |
binding.FileFactory~bucketMetadataCallback |
<optional> |
Invoked if the operation succeeds |
||||||||||||||||||||||||
failCallback |
binding.File~failCallback |
<optional> |
The callback is invoked if any error has occurred |
- Source:
Returns:
A promise which will fulfilled with the updated metadata
- Type
- Promise.<void>
Type Definitions
bucketMetadataCallback(bucketMetadata) → {*}
The list files callback is called, with the bucket metadata
Parameters:
Name | Type | Description |
---|---|---|
bucketMetadata |
Object.<string, util.Permission> | the bucket metadata |
- Source:
Returns:
A Promise, result or undefined
- Type
- *
fileListCallback(files) → {*}
The list files callback is called, with the loaded files
Parameters:
Name | Type | Description |
---|---|---|
files |
Array.<binding.File> | The listed files |
- Source:
Returns:
A Promise, result or undefined
- Type
- *