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

@effect/platform-node

Package Overview
Dependencies
Maintainers
3
Versions
428
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effect/platform-node - npm Package Compare versions

Comparing version 0.11.3 to 0.11.4

Http/NodeClient.d.ts

4

HttpClient.d.ts

@@ -15,2 +15,6 @@ /**

*/
export * as nodeClient from "@effect/platform-node/Http/NodeClient";
/**
* @since 1.0.0
*/
export * as request from "@effect/platform/Http/ClientRequest";

@@ -17,0 +21,0 @@ /**

4

HttpClient.js

@@ -6,3 +6,3 @@ "use strict";

});
exports.urlParams = exports.response = exports.request = exports.headers = exports.error = exports.client = exports.body = void 0;
exports.urlParams = exports.response = exports.request = exports.nodeClient = exports.headers = exports.error = exports.client = exports.body = void 0;
var body_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/Http/Body"));

@@ -12,2 +12,4 @@ exports.body = body_1;

exports.client = client_1;
var nodeClient_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform-node/Http/NodeClient"));
exports.nodeClient = nodeClient_1;
var request_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform/Http/ClientRequest"));

@@ -14,0 +16,0 @@ exports.request = request_1;

@@ -6,3 +6,3 @@ "use strict";

});
exports.fromReadable = void 0;
exports.toUint8Array = exports.toString = exports.fromReadable = void 0;
var Option = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Option"));

@@ -42,2 +42,41 @@ var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/io/Effect"));

const readChunk = (stream, size) => Effect.flatMap(_ => _ ? Effect.succeed(_) : Effect.fail(Option.none()))(Effect.sync(() => size._tag === "Some" ? stream.read(Number(size)) : stream.read()));
/** @internal */
const toString = (evaluate, onError, encoding = "utf-8") => Effect.async(resume => {
const stream = evaluate();
let string = "";
stream.setEncoding(encoding);
stream.once("error", err => {
resume(Effect.fail(onError(err)));
});
stream.once("end", () => {
resume(Effect.succeed(string));
});
stream.on("data", chunk => {
string += chunk;
});
return Effect.sync(() => {
stream.removeAllListeners();
stream.destroy();
});
});
/** @internal */
exports.toString = toString;
const toUint8Array = (evaluate, onError) => Effect.async(resume => {
const stream = evaluate();
let buffer = Buffer.alloc(0);
stream.once("error", err => {
resume(Effect.fail(onError(err)));
});
stream.once("end", () => {
resume(Effect.succeed(buffer));
});
stream.on("data", chunk => {
buffer = Buffer.concat([buffer, chunk]);
});
return Effect.sync(() => {
stream.removeAllListeners();
stream.destroy();
});
});
exports.toUint8Array = toUint8Array;
//# sourceMappingURL=stream.js.map
{
"name": "@effect/platform-node",
"version": "0.11.3",
"version": "0.11.4",
"description": "Unified interfaces for common platform-specific services",

@@ -31,4 +31,4 @@ "license": "MIT",

"@effect/stream": "^0.34.0",
"@effect/platform": "^0.11.3"
"@effect/platform": "^0.11.4"
}
}

@@ -16,2 +16,6 @@ /**

*/
export * as nodeClient from "@effect/platform-node/Http/NodeClient"
/**
* @since 1.0.0
*/
export * as request from "@effect/platform/Http/ClientRequest"

@@ -18,0 +22,0 @@ /**

@@ -61,1 +61,49 @@ import type { LazyArg } from "@effect/data/Function"

)
/** @internal */
export const toString = <E>(
evaluate: LazyArg<Readable>,
onError: (error: unknown) => E,
encoding: BufferEncoding = "utf-8"
): Effect.Effect<never, E, string> =>
Effect.async<never, E, string>((resume) => {
const stream = evaluate()
let string = ""
stream.setEncoding(encoding)
stream.once("error", (err) => {
resume(Effect.fail(onError(err)))
})
stream.once("end", () => {
resume(Effect.succeed(string))
})
stream.on("data", (chunk) => {
string += chunk
})
return Effect.sync(() => {
stream.removeAllListeners()
stream.destroy()
})
})
/** @internal */
export const toUint8Array = <E>(
evaluate: LazyArg<Readable>,
onError: (error: unknown) => E
): Effect.Effect<never, E, Uint8Array> =>
Effect.async<never, E, Uint8Array>((resume) => {
const stream = evaluate()
let buffer = Buffer.alloc(0)
stream.once("error", (err) => {
resume(Effect.fail(onError(err)))
})
stream.once("end", () => {
resume(Effect.succeed(buffer))
})
stream.on("data", (chunk) => {
buffer = Buffer.concat([buffer, chunk])
})
return Effect.sync(() => {
stream.removeAllListeners()
stream.destroy()
})
})

@@ -6,2 +6,3 @@ /**

import type { Option } from "@effect/data/Option"
import type { Effect } from "@effect/io/Effect"
import * as internal from "@effect/platform-node/internal/stream"

@@ -13,3 +14,3 @@ import type { Size } from "@effect/platform/FileSystem"

/**
* @category model
* @category models
* @since 1.0.0

@@ -23,3 +24,3 @@ */

/**
* @category constructor
* @category constructors
* @since 1.0.0

@@ -32,1 +33,20 @@ */

) => Stream<never, E, A> = internal.fromReadable
/**
* @since 1.0.0
* @category conversions
*/
export const toString: <E>(
evaluate: LazyArg<Readable>,
onError: (error: unknown) => E,
encoding?: BufferEncoding
) => Effect<never, E, string> = internal.toString
/**
* @since 1.0.0
* @category conversions
*/
export const toUint8Array: <E>(
evaluate: LazyArg<Readable>,
onError: (error: unknown) => E
) => Effect<never, E, Uint8Array> = internal.toUint8Array
/// <reference types="node" />
/// <reference types="node" />
/**

@@ -7,2 +8,3 @@ * @since 1.0.0

import type { Option } from "@effect/data/Option";
import type { Effect } from "@effect/io/Effect";
import type { Size } from "@effect/platform/FileSystem";

@@ -12,3 +14,3 @@ import type { Stream } from "@effect/stream/Stream";

/**
* @category model
* @category models
* @since 1.0.0

@@ -21,6 +23,16 @@ */

/**
* @category constructor
* @category constructors
* @since 1.0.0
*/
export declare const fromReadable: <E, A>(evaluate: LazyArg<Readable>, onError: (error: unknown) => E, options?: FromReadableOptions) => Stream<never, E, A>;
/**
* @since 1.0.0
* @category conversions
*/
export declare const toString: <E>(evaluate: LazyArg<Readable>, onError: (error: unknown) => E, encoding?: BufferEncoding) => Effect<never, E, string>;
/**
* @since 1.0.0
* @category conversions
*/
export declare const toUint8Array: <E>(evaluate: LazyArg<Readable>, onError: (error: unknown) => E) => Effect<never, E, Uint8Array>;
//# sourceMappingURL=Stream.d.ts.map

@@ -6,3 +6,3 @@ "use strict";

});
exports.fromReadable = void 0;
exports.toUint8Array = exports.toString = exports.fromReadable = void 0;
var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/platform-node/internal/stream"));

@@ -12,7 +12,19 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

/**
* @category constructor
* @category constructors
* @since 1.0.0
*/
const fromReadable = internal.fromReadable;
/**
* @since 1.0.0
* @category conversions
*/
exports.fromReadable = fromReadable;
const toString = internal.toString;
/**
* @since 1.0.0
* @category conversions
*/
exports.toString = toString;
const toUint8Array = internal.toUint8Array;
exports.toUint8Array = toUint8Array;
//# sourceMappingURL=Stream.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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