1.0.5 • Published 2 years ago

receive-slice-file-combin v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

receiveSliceFileCombin

const express = require('express');
const app = express();
const HandleSliceFile = require('receive-slice-file-combin')

app.post('/uploadFile', (req, res) => {
  const fileUid = req.headers['file-uid']
  const fileIndex = req.headers['file-index']
  const isLast = req.headers['upload-end'] === 'isLast'
  const handle = new HandleSliceFile({ catchDir: './upload', uploadDir: './files', uid: fileUid, index: fileIndex })

  handle.parse(req, isLast, (err, file, path) => {
    if (err) return console.log(err);
    const responseJson = { success: true, file }
    path && (responseJson.url = 'http://localhost:3000/' + path)
    res.json(responseJson)
  })
})

app.listen(3000, () => {
  console.log('Server run at http://localhost:3000');
})
1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago