Ver código fonte

switching to disk storage

master
Rich Brown 1 ano atrás
pai
commit
b7a4009cca
1 arquivos alterados com 3 adições e 3 exclusões
  1. +3
    -3
      routes/createRouter.js

+ 3
- 3
routes/createRouter.js Ver arquivo

@@ -3,8 +3,8 @@ import multer from 'multer';
// import Micropub from 'micropub-helper';
import fs from 'fs';

const storage = multer.memoryStorage();
const upload = multer({ storage });
// const storage = multer.memoryStorage();
const upload = multer({ dest: 'uploads/' });

const createRouter = express.Router();

@@ -36,7 +36,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: fs.createReadStream(file.buffer),
photo: fs.createReadStream(`./uploads/${file.path}`),
// photo: JSON.stringify({
// filename: file.originalname,
// buffer: file.buffer,


Carregando…
Cancelar
Salvar