selectel-storage-promise
v1.0.4
Published
Manage Selectel's storage
Downloads
6
Readme
Modules
Classes
Selectel
Manage Selectel's storage Selectel's Documentation
Selectel
Kind: global class
- Selectel
- new Selectel(request, requestPromise)
- .auth(login, pass) ⇒ Promise
- .info() ⇒ Promise
- .fetchContainers(format, limit, marker) ⇒ Promise
- .createContainer(containerName, containerType) ⇒ Promise
- .infoContainer(containerName) ⇒ Promise
- .editContainer(containerName, containerType) ⇒ Promise
- .deleteContainer(containerName) ⇒ Promise
- .fetchFiles(containerName, params) ⇒ Promise
- .uploadFile(fullLocalPath, hostingPath, additionalHeaders) ⇒ Promise
- .extractArchive(readStream, hostingPath, arhFormat) ⇒ Promise
- .copyFile(hostingPath, newPath) ⇒ Promise
- .deleteFile(filePath) ⇒ Promise
new Selectel(request, requestPromise)
Constructor function.
| Param | Type | | --- | --- | | request | Object | | requestPromise | Object |
selectel.auth(login, pass) ⇒ Promise
Gets the authentication token (key) for accessing storage and sets it internally.
Kind: instance method of Selectel
| Param | Type | Description | | --- | --- | --- | | login | string | account number | | pass | string | storage password |
selectel.info() ⇒ Promise
Returns general information about account: total number of containers, total number of objects, total volume of data stored, total volume of data downloaded.
Kind: instance method of Selectel
selectel.fetchContainers(format, limit, marker) ⇒ Promise
Returns the list of available containers.
Kind: instance method of Selectel
| Param | Type | Description | | --- | --- | --- | | format | string | 'json' or 'xml', 'json' is the default value | | limit | string | the maximum number of objects on a list (default - 10 000) | | marker | string | the name of the final container from the previous request |
selectel.createContainer(containerName, containerType) ⇒ Promise
Creates a new container.
Kind: instance method of Selectel
| Param | Type | Description | | --- | --- | --- | | containerName | string | name of the container | | containerType | string | container type: 'public', 'private' or 'gallery'. 'public' is the default value |
selectel.infoContainer(containerName) ⇒ Promise
Returns a container's information.
Kind: instance method of Selectel
| Param | Type | Description | | --- | --- | --- | | containerName | string | name of the container |
selectel.editContainer(containerName, containerType) ⇒ Promise
Changes a container's metadata.
Kind: instance method of Selectel
| Param | Type | Description | | --- | --- | --- | | containerName | string | name of the container | | containerType | string | container type: 'public', 'private' or 'gallery' |
selectel.deleteContainer(containerName) ⇒ Promise
Deletes the container.
Kind: instance method of Selectel
| Param | Type | Description | | --- | --- | --- | | containerName | string | name of the container |
selectel.fetchFiles(containerName, params) ⇒ Promise
Returns a list of files stored in the container.
Kind: instance method of Selectel
| Param | Type | Description | | --- | --- | --- | | containerName | string | name of the container | | params | Object | parameters. | | params.format | string | the format results are returned in (json or xml) | | params.limit | string | the maximum number of objects on a list (default - 10 000) | | params.marker | string | objects whose value exceeds the given marker (useful for page navigation and for large numbers of files) | | params.prefix | string | prints objects whose names start with the given prefix in line format | | params.path | string | returns objects in the given folder (virtual folder) | | params.delimiter | string | returns objects up to the given delimiter in the filename |
selectel.uploadFile(fullLocalPath, hostingPath, additionalHeaders) ⇒ Promise
Uploads a file to the container.
Kind: instance method of Selectel
| Param | Type | Description | | --- | --- | --- | | fullLocalPath | string | full local path to the file | | hostingPath | string | /{container}/{file} | | additionalHeaders | Object | { X-Delete-At: ..., X-Delete-After: ..., Etag: ..., X-Object-Meta: ... } |
selectel.extractArchive(readStream, hostingPath, arhFormat) ⇒ Promise
Extracts the archive.
Kind: instance method of Selectel
| Param | Type | Description | | --- | --- | --- | | readStream | pipe | read stream | | hostingPath | string | /{container}/{file} | | arhFormat | string | The archive type: 'tar', 'tar.gz' or 'tar.bz2' |
selectel.copyFile(hostingPath, newPath) ⇒ Promise
Copies a file to the given folder.
Kind: instance method of Selectel
| Param | Type | Description | | --- | --- | --- | | hostingPath | string | /{container}/{file} | | newPath | string | /{container}/{new-file} |
selectel.deleteFile(filePath) ⇒ Promise
Deletes the given file.
Kind: instance method of Selectel
| Param | Type | Description | | --- | --- | --- | | filePath | string | /{container}/{file} |