Skip to content

Commit e521be5

Browse files
committed
more logs
1 parent 4d2d035 commit e521be5

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

src/index.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,21 @@ const parseMultipart = async (event) => {
6969
let fileBuffer = null;
7070

7171
busboy.on('file', (fieldname, file, filename, encoding, mimetype) => {
72-
if (fieldname !== 'file') {
73-
reject(new Error('Unexpected fieldname. Expected "file".'));
74-
}
75-
72+
console.log(
73+
`File received: ${filename}, encoding: ${encoding}, mimetype: ${mimetype}`
74+
);
7675
const chunks = [];
77-
file.on('data', (chunk) => chunks.push(chunk));
76+
file.on('data', (chunk) => {
77+
console.log('Chunk received:', chunk.toString('hex'));
78+
chunks.push(chunk);
79+
});
7880
file.on('end', () => {
81+
console.log('File upload finished');
7982
fileBuffer = Buffer.concat(chunks);
83+
console.log(
84+
'Final buffer (first 10 bytes):',
85+
fileBuffer.slice(0, 10).toString('hex')
86+
);
8087
});
8188
});
8289

0 commit comments

Comments
 (0)