Constructor
new Store(params)
Interact with an object in an S3 bucket.
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params | Object | Properties
|
- Since
- 1.17.0
Classes
Methods
(async) copy(params)
Copy a file into the item from another part of the storage. This capability is specifically to support using different locations in the bucket for working data and repository data where the repository data might contain versioned copies of the working data.
This method is an event emitter. Listen to events using the store handle.
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params | Object | Properties
|
- Since
- 1.18.0
const store = new Store({})
store.on("copy", (msg) => console.log(msg));
// where msg = { msg: 'Copied batch 1/1 (1/1 files)', date: date as ISO String }
(async) createObject() → {Boolean}
Create the object in the storage.
- Since
- 1.17.0
- Type:
- Boolean
(async) delete(params)
Remove a file or files from an item in the storage. Files will also be removed from the hasPart property of the root dataset.
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params | Object | Properties
|
(async) exists() → {Boolean}
Check whether the object exists in the storage.
- Since
- 1.17.0
- Type:
- Boolean
(async) fileExists(params) → {Boolean}
Check whether the path exists in the storage.
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
params | Object | Properties
|
- Since
- 1.17.0
- Type:
- Boolean
(async) get(params)
Get a file from the item on the storage.
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
params | Object | Properties
|
(async) getJSON(params)
Get a JSON file from the item on the storage.
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
params | Object | Properties
|
(async) getObjectIdentifier() → {Object}
Get the object identifier.
- Since
- 1.17.0
- Type:
- Object
(async) getObjectInventory() → {Object}
Get the object inventory file.
- Since
- 1.17.0
- Type:
- Object
getObjectPath() → {String}
Get the path of the object in the storage.
- Since
- 1.17.0
- Type:
- String
(async) getPresignedUrl(params)
Get a presigned link to the file.
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
params | Object | Properties
|
(async) hashTarget(params) → {String}
Calculate the SHA512 hash of a file in storage
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
params | Object | Properties
|
- the hash of the file or undefined
- Type:
- String
(async) listFileVersions(params) → {Array}
Get file versions.
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
params | Object | Properties
|
- versions of the specified file ordered newest to oldest. The file as named (ie without a version string will be the first - newest - entry)
- Type:
- Array
(async) listResources() → {Array.<String>}
Recursively walk and list all of the files for the item.
- a list of files
- Type:
- Array.<String>
(async) put(params)
Put a file or batch of files into the item on the storage.
This method is an event emitter. Listen to events using the store handle.
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params | Object | Properties
|
const store = new Store({})
store.on("put", (msg) => console.log(msg));
// where msg = { msg: 'Uploaded batch 1/1 (1/1 files)', date: date as ISO String }
(async) registerFilesInCrateMetadata(filesopt)
Register a set of files in ro-crate-metadata.json. If no files are defined the method will register all files that are not special files. This includes the ro-crate-metadata file (or any version of it).
Name | Type | Attributes | Description |
---|---|---|---|
files | Array.<String> | <optional> | if provided, the array of file names to be registered, relative to the root of the object. |
- Since
- 1.18.0
(async) removeObject()
Delete the object in the storage.
- Since
- 1.17.0
resolvePath() → {String}
Resolve the full path of a file in the storage
Name | Type | Description |
---|---|---|
params.path | String | the path to the file relative to the object root that it to be resolved |
- Since
- 1.17.0
- the full path to a file
- Type:
- String
(async) stat(params) → {Boolean}
Return the file stat.
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
params | Object | Properties
|
- Type:
- Boolean