Update media-service.js

This commit is contained in:
Lakshmi C Rajeev
2019-12-02 15:27:38 +05:30
committed by GitHub
parent 7137bf227e
commit 9205e0893a

View File

@@ -1,10 +1,9 @@
module.exports = (srv) => {
var loki = require('lokijs');
var db = new loki('DB');
var mediaDB= db.addCollection("Media");
var Readable = require('stream').Readable;
var PassThroughStream = require('stream').PassThrough;
const loki = require('lokijs');
const db = new loki('DB');
const mediaDB= db.addCollection("Media");
const { Readable, PassThrough } = require('stream')
srv.before('CREATE', 'Media', (req) => {
var obj = mediaDB.insert({media: ""});
@@ -21,7 +20,7 @@ module.exports = (srv) => {
req.reject(404,"No record found for the ID");
return;
}
var stream = new PassThroughStream();
var stream = new PassThrough();
let chunks = [];
stream.on('data', (chunk) => {
chunks.push(chunk);
@@ -80,4 +79,4 @@ module.exports = (srv) => {
return result
}
}
}