Use constant for encoding

This commit is contained in:
Jan Oberhauser 2020-03-20 22:47:47 +01:00
parent 8d8b9c9652
commit 122a0c79a3

View file

@ -1,4 +1,5 @@
import {
BINARY_ENCODING,
IWebhookFunctions,
} from 'n8n-core';
@ -330,7 +331,7 @@ export class Webhook implements INodeType {
const fileContent = await fs.promises.readFile(files[file].path);
const buffer = Buffer.from(fileContent);
set(returnData[0], `binary[${fileName}]`, {
data: buffer.toString('base64'),
data: buffer.toString(BINARY_ENCODING),
mimeType: fileJson.type,
fileName: fileJson.name,
fileExtension,
@ -357,7 +358,7 @@ export class Webhook implements INodeType {
response.binary = {
data: {
// @ts-ignore
data: req.rawBody.toString('base64'),
data: req.rawBody.toString(BINARY_ENCODING),
mimeType,
}
};