New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-livestream-metainfo

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-livestream-metainfo - npm Package Compare versions

Comparing version

to
1.0.2

20

index.js
const fetch = require("node-fetch");
const { pipeline } = require("stream");
const { promisify } = require("util");
const streamPipeline = promisify(pipeline);
const regex = /StreamTitle=(.*?);/

@@ -17,10 +13,9 @@

const song = await new Promise(resolve => {
streamPipeline(response.body, async source => {
source.setEncoding("utf8");
for await (const chunk of source) {
if (regex.test(chunk)) {
const song = chunk.match(regex)[1];
resolve(song.substring(1, song.length - 1));
}
response.body.on("data", chunk => {
chunk = chunk.toString();
if (regex.test(chunk)) {
response.body.destroy();
const song = chunk.match(regex)[1];
return resolve(song.substring(1, song.length - 1));
}

@@ -33,2 +28,3 @@ });

description: response.headers.get("icy-description"),
genre: response.headers.get("icy-genre"),
bitrate: parseInt(response.headers.get("icy-br")),

@@ -35,0 +31,0 @@ audioInfo: response.headers.get("ice-audio-info"),

4

package.json
{
"name": "node-livestream-metainfo",
"version": "1.0.0",
"version": "1.0.2",
"description": "Lightweight module for fetching basic meta information from livestreams",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node test.js"
},

@@ -9,0 +9,0 @@ "repository": {