Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function upload() {
/* eslint no-param-reassign: 0 */
this.use("upload",
m.single("uri"),
(req, res, next) => {
req.feathers.file = req.file
next()
},
blobService({Model: blobStorage})
)
this.service("upload").before({
create: [
isRole("guest"),
hook => {
if (!hook.data.uri && hook.params.file) {
const file = hook.params.file
hook.data = {uri: dauria.getBase64DataURI(file.buffer, file.mimetype)}
}
if (!hook.data.uri && hook.data.file) {
hook.data = {uri: dauria.getBase64DataURI(file.buffer, file.mimetype)}
}
}
]
})
}
export function createFileService() {
const blobStorageModel = fsBlobStore(resolve(__dirname, '../files'));
return blobService({ Model: blobStorageModel });
}