mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
* [ADF-4152] Moved core library docs into subfolders * [ADF-4152] Moved core library docs into subfolders * [ADF-4152] Manual fixes to core doc file links * [ADF-4152] Further automatic + manual link tidying
47 lines
3.5 KiB
Markdown
47 lines
3.5 KiB
Markdown
---
|
|
Title: Download zip service
|
|
Added: v2.0.0
|
|
Status: Active
|
|
Last reviewed: 2019-01-08
|
|
---
|
|
|
|
# [Download zip service](../../../lib/core/services/download-zip.service.ts "Defined in download-zip.service.ts")
|
|
|
|
Creates and manages downloads.
|
|
|
|
## Class members
|
|
|
|
### Methods
|
|
|
|
- **cancelDownload**(downloadId: `string`)<br/>
|
|
Cancels a download.
|
|
- _downloadId:_ `string` - ID of the target download node
|
|
- **createDownload**(payload: [`DownloadBodyCreate`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadBodyCreate.md)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadEntry.md)`>`<br/>
|
|
Creates a new download.
|
|
- _payload:_ [`DownloadBodyCreate`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadBodyCreate.md) - Object containing the node IDs of the items to add to the ZIP file
|
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadEntry.md)`>` - Status object for the download
|
|
- **getContentUrl**(nodeId: `string`, attachment?: `boolean`): `string`<br/>
|
|
Gets a content URL for the given node.
|
|
- _nodeId:_ `string` - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) to get URL for.
|
|
- _attachment:_ `boolean` - (Optional) Toggles whether to retrieve content as an attachment for download
|
|
- **Returns** `string` - URL string
|
|
- **getDownload**(downloadId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadEntry.md)`>`<br/>
|
|
Gets status information for a download node.
|
|
- _downloadId:_ `string` - ID of the download node
|
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadEntry.md)`>` - Status object for the download
|
|
- **getNode**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>`<br/>
|
|
Gets a Node via its node ID.
|
|
- _nodeId:_ `string` - ID of the target node
|
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>` - Details of the node
|
|
|
|
## Details
|
|
|
|
Use `createDownload` to create a node that will represent the downloadable
|
|
ZIP data. The ZIP archive includes the content of all node IDs passed in via
|
|
the [`DownloadBodyCreate`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadBodyCreate.md) parameter.
|
|
|
|
The [`DownloadEntry`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/DownloadEntry.md) object returned by `createDownload` has an
|
|
`id` field that you can use to identify the download node (eg,
|
|
to cancel it later or get the node URL when the download is complete) and
|
|
other information about the progress of the download.
|