]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/core-utils.ts
Live streaming implementation first step
[github/Chocobozzz/PeerTube.git] / server / helpers / core-utils.ts
index b1f5d9610ba28d6e4cbf996cf0000fbd4d1835c1..49eee7c591323f0fca9eb17e0807002d7ff01c0a 100644 (file)
@@ -175,6 +175,16 @@ function pageToStartAndCount (page: number, itemsPerPage: number) {
   return { start, count: itemsPerPage }
 }
 
+function mapToJSON (map: Map<any, any>) {
+  const obj: any = {}
+
+  for (const [ k, v ] of map) {
+    obj[k] = v
+  }
+
+  return obj
+}
+
 function buildPath (path: string) {
   if (isAbsolute(path)) return path
 
@@ -263,6 +273,7 @@ export {
 
   sha256,
   sha1,
+  mapToJSON,
 
   promisify0,
   promisify1,