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

@travetto/base

Package Overview
Dependencies
Maintainers
1
Versions
357
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/base - npm Package Compare versions

Comparing version 3.3.0 to 3.3.1

2

__index__.ts

@@ -1,3 +0,1 @@

/// <reference path="./src/fetch.d.ts" />
export * from './src/console';

@@ -4,0 +2,0 @@ export * from './src/data';

4

package.json
{
"name": "@travetto/base",
"version": "3.3.0",
"version": "3.3.1",
"description": "Environment config and common utilities for travetto applications.",

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

"dependencies": {
"@travetto/manifest": "^3.3.0",
"@travetto/manifest": "^3.3.1",
"@types/source-map-support": "^0.5.6",

@@ -32,0 +32,0 @@ "source-map-support": "^0.5.21"

@@ -91,3 +91,3 @@ <!-- This file was generated by @travetto/doc and should not be modified directly -->

NODE_ENV: detectNodeEnv(envName),
DEBUG: envName !== TEST ? (cfg.debug ?? GlobalEnv.debug) : false,
DEBUG: envName !== TEST ? (cfg.debug ?? GlobalEnv.debug ?? false) : false,
TRV_ENV: envName,

@@ -94,0 +94,0 @@ TRV_DYNAMIC: cfg.dynamic ?? GlobalEnv.dynamic,

import fs from 'fs/promises';
import { createWriteStream, createReadStream } from 'fs';
import { PassThrough, Readable, Writable } from 'stream';
import { ReadableStream as WebReadableStream } from 'stream/web';
import rl from 'readline';

@@ -9,5 +10,4 @@

import type { ExecutionState } from './exec';
import type { _Fetch } from './fetch';
type All = Buffer | string | Readable | Uint8Array | NodeJS.ReadableStream | _Fetch.ReadableStream;
type All = Buffer | string | Readable | Uint8Array | NodeJS.ReadableStream | WebReadableStream;

@@ -20,25 +20,2 @@ /**

/**
* Convert a fetch/ReadableStream into a standard node Readable
* @param src
* @returns
*/
static fetchBodyToStream(src: _Fetch.ReadableStream): Readable {
const reader = src.getReader();
return new Readable({
read(): void {
reader.read().then(({ done, value }) => {
if (value) {
this.push(value);
}
if (done) {
this.push(null);
}
});
},
emitClose: true
});
}
/**
* Convert buffer to a stream

@@ -57,5 +34,5 @@ * @param src The buffer to stream

*/
static async streamToBuffer(src: Readable | NodeJS.ReadableStream | _Fetch.ReadableStream): Promise<Buffer> {
static async streamToBuffer(src: Readable | NodeJS.ReadableStream | WebReadableStream): Promise<Buffer> {
if ('getReader' in src) {
return this.streamToBuffer(this.fetchBodyToStream(src));
return this.streamToBuffer(Readable.fromWeb(src));
}

@@ -97,3 +74,3 @@ return new Promise<Buffer>((res, rej) => {

} else if (typeof src !== 'string' && 'getReader' in src) {
return this.fetchBodyToStream(src);
return Readable.fromWeb(src);
} else {

@@ -100,0 +77,0 @@ return this.bufferToStream(await this.toBuffer(src));

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