Uses middleware pattern.
Each time we use app.use we add an other middleware function.
ctx - The context contains all the information for a signle request and the response object aswell.
next - Calls the next middleware.
const { normalize } = require('ffmpeg-normalize'); | |
normalize({ | |
input: 'input.mp4', | |
output: 'output.mp4', | |
loudness: { | |
normalization: 'ebuR128', | |
target: | |
{ | |
input_i: -23, |
ffmpeg -i input.mp4 -af loudnorm=I=-23:LRA=7:tp=-2:print_format=json -f null - | |
ffmpeg -i input.mp4 -af | |
loudnorm=I=-23:LRA=7:tp=-2:measured_I=-30:measured_LRA=1.1:measured_tp=-11 04:measured_thresh=-40.21:offset=-0.47 -ar 48k -y output.mp4 |
const { Benchmark } = require("benchmark"); | |
function generateRandomNumberBetween(min, max){ | |
return Math.floor(Math.random() * max) + min; | |
} | |
function generateTupleArray(length) { | |
const tupleArray = []; | |
for (let i = 0; i < length; i++) { | |
tupleArray.push([generateRandomNumberBetween(1, 1e3), generateRandomNumberBetween(1, 1e3)]); | |
} | |
return tupleArray; |
let arr = [ [1, 2], [3, 4]]; | |
// version 1 | |
arr.reduce((acc, curr) => acc.concat(curr), []); | |
// version 2 | |
arr.reduce((acc, curr) => [...acc, ...curr], []); | |
// version 3 | |
[].concat(...arr); |
const { Benchmark } = require("benchmark"); | |
function generateRandomString(length) { | |
var result = ""; | |
var characters = | |
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | |
var charactersLength = characters.length; | |
for (var i = 0; i < length; i++) { | |
result += characters.charAt(Math.floor(Math.random() * charactersLength)); | |
} | |
return result; |
// version 1 | |
"hello".split("").reverse(); | |
// version 2 | |
[..."hello"].reverse(); | |
// version 3 | |
Array.from("hello").reverse(); |
const { Benchmark } = require("benchmark"); | |
function generateRandomNumberBetween(min, max){ | |
return Math.floor(Math.random() * max) + min; | |
} | |
function generateTupleArray(length) { | |
const tupleArray = []; | |
for (let i = 0; i < length; i++) { | |
tupleArray.push([generateRandomNumberBetween(1, 1e3), generateRandomNumberBetween(1, 1e3)]); | |
} | |
return tupleArray; |
'use strict'; | |
const util = require('util'); | |
const fs = require('fs'); | |
const write = util.promisify(fs.writeFile); | |
module.exports = ({ image, identifier, directory }) => { | |
try { | |
const extension = image.split(';')[0].match(/jpeg|png|gif/)[0]; | |
const data = image.replace(/^data:image\/\w+;base64,/, ''); |
// Chrome 63 | |
let peerConnectionObject = ... // Some peer connection | |
peerConnectionObject.getStats(function(res) { | |
console.log(res.result()); | |
}); |