I have the following file uploaded to an Express.js API, using Multer
[ { fieldname: 'file',
originalname: 'file.pdf',
encoding: '7bit',
mimetype: 'application/pdf',
destination: 'temp/',
filename: 'b9e10b5ecce35483ff38c0e83b41a9f5',
path: 'temp/b9e10b5ecce35483ff38c0e83b41a9f5',
size: 456904 } ]
I passed it to the IPFS protocol with the ipfs.add() using the following function
ipfs.add({
path: listItem.path,
content: fileBuffer,
}, (err, file) => {
if (err) reject(err);
console.log(file)
});
Which in the console.log()
returns the following output
[ { path: 'temp/b9e10b5ecce35483ff38c0e83b41a9f5',
hash: 'QmUNLLsPACC***',
size: 4 },
{ path: 'temp',
hash: 'QmfQjRQnQkV***',
size: 82 } ]
My question is, why the second item appears if its supposed to be just adding the PDF file, and why it has my temp folder as a path, it is uploading all inside it?