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

ai-decode

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ai-decode - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

26

index.js

@@ -1,5 +0,23 @@

export default async function aiDecode(data) {
for (const item of data) {
await item;
}
import AsyncIterable from "asynciterable";
import { TextDecoder } from "util";
export default function aiDecode(iterable, encoding = "utf8") {
const decoder = new TextDecoder(encoding);
const generator = iterable[Symbol.asyncIterator] || iterable[Symbol.iterator];
const iterator = generator.call(iterable);
return new AsyncIterable(async (write, end) => {
let item = {};
while (!item.done) {
item = await iterator.next();
if (!item.done) {
write(decoder.decode(item.value, { stream: true }));
}
}
const lastChunk = decoder.decode();
if (lastChunk) {
write(lastChunk);
}
end();
});
}
{
"name": "ai-decode",
"version": "0.0.1",
"version": "0.1.0",
"description": "Decode a Buffer async iterable into a String async iterable.",

@@ -44,2 +44,4 @@ "repository": "parro-it/ai-decode",

"@std/esm": "^0.18.0",
"ai-concat": "^1.3.0",
"ai-node": "^0.1.1",
"documentation": "^5.3.3",

@@ -49,3 +51,7 @@ "linterjs": "^1.11.0",

"tape-async": "^2.3.0"
},
"dependencies": {
"asynciterable": "^1.1.0",
"prettier": "^1.8.2"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc