Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fetch-event-stream

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-event-stream - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

esm/deps/jsr.io/@std/http/0.220.1/server_sent_event_stream.js

2

esm/utils.js

@@ -1,2 +0,2 @@

import { TextLineStream } from './deps/deno.land/std@0.220.1/streams/text_line_stream.js';
import { TextLineStream } from './deps/jsr.io/@std/streams/0.220.1/text_line_stream.js';
export function stream(input) {

@@ -3,0 +3,0 @@ let decoder = new TextDecoderStream();

{
"name": "fetch-event-stream",
"version": "0.1.2",
"version": "0.1.3",
"description": "A tiny (745b) utility for Server Sent Event (SSE) streaming via `fetch` and Web Streams API",

@@ -41,3 +41,3 @@ "keywords": [

},
"_generatedBy": "dnt@0.40.0"
"_generatedBy": "dnt@dev"
}

@@ -12,2 +12,8 @@ <!-- deno-fmt-ignore-file -->

***Why?***
1. Even though [`EventSource`](https://developer.mozilla.org/en-US/docs/Web/API/EventSource) exists in browsers (and Deno!), it only sends `GET` requests and does not allow for custom HTTP headers. Most APIs (eg, Anthropic, OpenAI) require `POST` requests with an `Authorization` header and a JSON payload.
2. Web Streams are new, not very well understood, and are sometimes confused with NodeJS Streams. Because of this, many other libraries embed large polyfills or manually reconstruct desired behaviors through non-standard approaches. These polyfills are generally [not necessary](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API#browser_compatibility) anymore, but still make large impacts on SDK size; for example, [`openai`](https://bundlejs.com/?q=openai%404.29.2) is `17kB` (gzip).
## Install

@@ -14,0 +20,0 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fallback = exports.split = exports.stream = void 0;
const text_line_stream_js_1 = require("./deps/deno.land/std@0.220.1/streams/text_line_stream.js");
const text_line_stream_js_1 = require("./deps/jsr.io/@std/streams/0.220.1/text_line_stream.js");
function stream(input) {

@@ -6,0 +6,0 @@ let decoder = new TextDecoderStream();

@@ -1,2 +0,2 @@

import type { ServerSentEventMessage } from './deps/deno.land/std@0.220.1/http/server_sent_event_stream.js';
import type { ServerSentEventMessage } from './deps/jsr.io/@std/http/0.220.1/server_sent_event_stream.js';
export type { ServerSentEventMessage };

@@ -62,1 +62,2 @@ /**

export declare function stream(input: RequestInfo | URL, init?: RequestInit): Promise<AsyncGenerator<ServerSentEventMessage, void, unknown>>;
//# sourceMappingURL=mod.d.ts.map
export declare function stream(input: ReadableStream<Uint8Array>): ReadableStream<string>;
export declare function split(input: string): string[] | undefined;
export declare function fallback(headers: Headers, key: string, value: string): void;
//# sourceMappingURL=utils.d.ts.map
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