n8n-nodes-feishu-lark
Version:
n8n custom nodes for n8n to interact with Feishu/Lark, including Lark Bot, Lark MCP, and Lark Trigger.
49 lines • 2.07 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const form_data_1 = __importDefault(require("form-data"));
const RequestUtils_1 = __importDefault(require("../../../help/utils/RequestUtils"));
const wording_1 = require("../../../help/wording");
const description_1 = require("../../../help/description");
exports.default = {
name: wording_1.WORDING.UploadFile,
value: "uploadFile",
order: 170,
options: [
{
...description_1.DESCRIPTIONS.FOLDER_TOKEN,
required: true,
},
description_1.DESCRIPTIONS.FILE_BINARY_FIELD,
{
displayName: `<a target="_blank" href="https://open.feishu.cn/document/server-docs/docs/drive-v1/upload/multipart-upload-file-/introduction">${wording_1.WORDING.OpenDocument}</a>`,
name: 'notice',
type: 'notice',
default: '',
},
],
async call(index) {
const folderToken = this.getNodeParameter('folder_token', index, undefined, {
extractValue: true,
});
const fileBinaryField = this.getNodeParameter('file_binary_field', index);
const binaryData = await this.helpers.assertBinaryData(index, fileBinaryField);
const buffer = await this.helpers.getBinaryDataBuffer(index, fileBinaryField);
const formData = new form_data_1.default();
formData.append('file_name', binaryData.fileName);
formData.append('parent_type', 'explorer');
formData.append('parent_node', folderToken);
formData.append('size', buffer.length);
formData.append('file', buffer);
const { data } = await RequestUtils_1.default.request.call(this, {
method: 'POST',
url: '/open-apis/drive/v1/files/upload_all',
body: formData,
json: true,
});
return data;
},
};
//# sourceMappingURL=FileUpload.operation.js.map