UNPKG

n8n-nodes-placid

Version:

n8n node to interact with Placid API for creative generation

22 lines 916 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.buildMultipartBody = buildMultipartBody; function buildMultipartBody(files) { const boundary = '----n8nPlacidBoundary' + Date.now().toString(36) + Math.random().toString(36).slice(2); const parts = []; for (const file of files) { const safeFilename = file.filename.replace(/["\\r\n]/g, '_'); const header = `--${boundary}\r\n` + `Content-Disposition: form-data; name="${file.key}"; filename="${safeFilename}"\r\n` + `Content-Type: ${file.contentType}\r\n\r\n`; parts.push(Buffer.from(header, 'utf-8')); parts.push(file.buffer); parts.push(Buffer.from('\r\n', 'utf-8')); } parts.push(Buffer.from(`--${boundary}--\r\n`, 'utf-8')); return { body: Buffer.concat(parts), boundary, }; } //# sourceMappingURL=multipartUtils.js.map