Browse Source

buffer.from

master
Rich Brown 1 year ago
parent
commit
96e0056ef0
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      routes/createRouter.js

+ 4
- 2
routes/createRouter.js View File

@@ -28,7 +28,9 @@ function sanitizeFile(file, cb) {

createRouter.post('/form', upload.single('file'), (req, res) => {
const { file, body: { title, body, arrayOfTags } } = req;
console.log(file.buffer);
console.log(Buffer.from(file.buffer));
// const img = fs.readFileSync(file.path);
// const encode_image = file.toS
return req.app.locals.mp
.create(
{
@@ -36,7 +38,7 @@ createRouter.post('/form', upload.single('file'), (req, res) => {
name: title, // i thought MF syntax was 'p-name' but voxpelli's formattr turns NAME to TITLE
content: body,
category: arrayOfTags,
photo: [file.buffer],
photo: Buffer.from(file.buffer),
},
'multipart',
)


Loading…
Cancel
Save