Browse Source

fs

master
Rich Brown 1 year ago
parent
commit
28cf1ced5e
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      routes/createRouter.js

+ 6
- 4
routes/createRouter.js View File

@@ -1,6 +1,7 @@
import express from 'express';
import multer from 'multer';
// import Micropub from 'micropub-helper';
import fs from 'fs';

const storage = multer.memoryStorage();
const upload = multer({ storage });
@@ -35,10 +36,11 @@ 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: JSON.stringify({
filename: file.originalname,
buffer: file.buffer,
}),
photo: fs.createReadStream(file),
// photo: JSON.stringify({
// filename: file.originalname,
// buffer: file.buffer,
// }),
},
'multipart',
)


Loading…
Cancel
Save