🔀 Merge pull request #393 from RicardoE105/feature/multipart-data-fix

 encode file to base64
This commit is contained in:
Jan 2020-03-20 22:45:47 +01:00 committed by GitHub
commit 8d8b9c9652
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -328,8 +328,9 @@ export class Webhook implements INodeType {
const fileJson = files[file].toJSON() as IDataObject; const fileJson = files[file].toJSON() as IDataObject;
const [fileName, fileExtension] = (fileJson.name as string).split('.'); const [fileName, fileExtension] = (fileJson.name as string).split('.');
const fileContent = await fs.promises.readFile(files[file].path); const fileContent = await fs.promises.readFile(files[file].path);
const buffer = Buffer.from(fileContent);
set(returnData[0], `binary[${fileName}]`, { set(returnData[0], `binary[${fileName}]`, {
data: fileContent, data: buffer.toString('base64'),
mimeType: fileJson.type, mimeType: fileJson.type,
fileName: fileJson.name, fileName: fileJson.name,
fileExtension, fileExtension,