UNPKG

@n8n/n8n-nodes-langchain

Version:

![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)

60 lines 2.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.description = void 0; exports.execute = execute; const n8n_workflow_1 = require("n8n-workflow"); const utils_1 = require("../../helpers/utils"); const properties = [ { displayName: 'URL', name: 'url', type: 'string', placeholder: 'e.g. https://generativelanguage.googleapis.com/v1beta/files/abcdefg:download', description: 'The URL from Google Gemini API to download the video from', default: '', }, { displayName: 'Options', name: 'options', placeholder: 'Add Option', type: 'collection', default: {}, options: [ { displayName: 'Put Output in Field', name: 'binaryPropertyOutput', type: 'string', default: 'data', hint: 'The name of the output field to put the binary file data in', }, ], }, ]; const displayOptions = { show: { operation: ['download'], resource: ['video'], }, }; exports.description = (0, n8n_workflow_1.updateDisplayOptions)(displayOptions, properties); async function execute(i) { const url = this.getNodeParameter('url', i, ''); const binaryPropertyOutput = this.getNodeParameter('options.binaryPropertyOutput', i, 'data'); const credentials = await this.getCredentials('googlePalmApi'); const { fileContent, mimeType } = await utils_1.downloadFile.call(this, url, 'video/mp4', { key: credentials.apiKey, }); const fileName = (0, utils_1.getFilenameFromMimeType)(mimeType, 'video', 'mp4'); const binaryData = await this.helpers.prepareBinaryData(fileContent, fileName, mimeType); return [ { binary: { [binaryPropertyOutput]: binaryData }, json: { ...binaryData, data: undefined, }, pairedItem: { item: i }, }, ]; } //# sourceMappingURL=download.operation.js.map