const modelUtils = require('./utils')
const customVideosValidators = require('../helpers/custom-validators').videos
const modelUtils = require('./utils')
const customVideosValidators = require('../helpers/custom-validators').videos
const thumbnailPath = pathUtils.join(constants.CONFIG.STORAGE.THUMBNAILS_DIR, this.getThumbnailName())
fs.readFile(thumbnailPath, function (err, thumbnailData) {
if (err) {
const thumbnailPath = pathUtils.join(constants.CONFIG.STORAGE.THUMBNAILS_DIR, this.getThumbnailName())
fs.readFile(thumbnailPath, function (err, thumbnailData) {
if (err) {
tags: map(self.Tags, 'name'),
createdAt: self.createdAt,
extname: self.extname
tags: map(self.Tags, 'name'),
createdAt: self.createdAt,
extname: self.extname
// Creating the thumbnail for a remote video
const thumbnailName = video.getThumbnailName()
const thumbnailPath = constants.CONFIG.STORAGE.THUMBNAILS_DIR + thumbnailName
// Creating the thumbnail for a remote video
const thumbnailName = video.getThumbnailName()
const thumbnailPath = constants.CONFIG.STORAGE.THUMBNAILS_DIR + thumbnailName
- fs.writeFile(thumbnailPath, thumbnailData, { encoding: 'base64' }, function (err) {
+ fs.writeFile(thumbnailPath, Buffer.from(thumbnailData, 'binary'), function (err) {
if (err) return callback(err)
return callback(null, thumbnailName)
if (err) return callback(err)
return callback(null, thumbnailName)