@remix-run/node 0.0.0-experimental-8d8ac4a52 → 0.0.0-experimental-e48b44da5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +19 -4
- package/dist/crypto.js +1 -1
- package/dist/globals.d.ts +0 -5
- package/dist/globals.js +19 -14
- package/dist/implementations.js +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.js +13 -24
- package/dist/sessions/fileStorage.d.ts +1 -0
- package/dist/sessions/fileStorage.js +15 -14
- package/dist/stream.d.ts +1 -1
- package/dist/stream.js +24 -29
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/upload/fileUploadHandler.d.ts +2 -1
- package/dist/upload/fileUploadHandler.js +38 -19
- package/install.d.ts +1 -0
- package/install.js +8 -0
- package/package.json +21 -9
- package/dist/base64.d.ts +0 -2
- package/dist/base64.js +0 -23
- package/dist/fetch.d.ts +0 -23
- package/dist/fetch.js +0 -65
- package/dist/magicExports/esm/remix.js +0 -11
- package/dist/magicExports/remix.d.ts +0 -42
- package/dist/magicExports/remix.js +0 -36
package/LICENSE.md
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Copyright (c) Remix Software Inc. 2020-2021
|
|
4
|
+
Copyright (c) Shopify Inc. 2022-2023
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/dist/crypto.js
CHANGED
package/dist/globals.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { atob, btoa } from "./base64";
|
|
2
1
|
declare global {
|
|
3
2
|
namespace NodeJS {
|
|
4
3
|
interface ProcessEnv {
|
|
5
4
|
NODE_ENV: "development" | "production" | "test";
|
|
6
5
|
}
|
|
7
6
|
interface Global {
|
|
8
|
-
atob: typeof atob;
|
|
9
|
-
btoa: typeof btoa;
|
|
10
|
-
Blob: typeof Blob;
|
|
11
7
|
File: typeof File;
|
|
12
8
|
Headers: typeof Headers;
|
|
13
9
|
Request: typeof Request;
|
|
@@ -16,7 +12,6 @@ declare global {
|
|
|
16
12
|
FormData: typeof FormData;
|
|
17
13
|
ReadableStream: typeof ReadableStream;
|
|
18
14
|
WritableStream: typeof WritableStream;
|
|
19
|
-
AbortController: typeof AbortController;
|
|
20
15
|
}
|
|
21
16
|
}
|
|
22
17
|
}
|
package/dist/globals.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/node v0.0.0-experimental-
|
|
2
|
+
* @remix-run/node v0.0.0-experimental-e48b44da5
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -12,26 +12,31 @@
|
|
|
12
12
|
|
|
13
13
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
14
|
|
|
15
|
-
var webStream = require('@remix-run/web-stream');
|
|
16
|
-
var abortController = require('abort-controller');
|
|
17
|
-
var base64 = require('./base64.js');
|
|
18
|
-
var fetch = require('./fetch.js');
|
|
19
|
-
var webFile = require('@remix-run/web-file');
|
|
20
15
|
var webFetch = require('@remix-run/web-fetch');
|
|
16
|
+
var webStream = require('@remix-run/web-stream');
|
|
21
17
|
|
|
22
18
|
function installGlobals() {
|
|
23
|
-
global.
|
|
24
|
-
global.btoa = base64.btoa;
|
|
25
|
-
global.Blob = webFile.Blob;
|
|
26
|
-
global.File = webFile.File;
|
|
19
|
+
global.File = webFetch.File;
|
|
27
20
|
global.Headers = webFetch.Headers;
|
|
28
|
-
global.Request =
|
|
29
|
-
global.Response =
|
|
30
|
-
global.fetch =
|
|
21
|
+
global.Request = webFetch.Request;
|
|
22
|
+
global.Response = webFetch.Response;
|
|
23
|
+
global.fetch = webFetch.fetch;
|
|
31
24
|
global.FormData = webFetch.FormData;
|
|
25
|
+
|
|
26
|
+
// Export everything from https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
|
|
27
|
+
global.ByteLengthQueuingStrategy = webStream.ByteLengthQueuingStrategy;
|
|
28
|
+
global.CountQueuingStrategy = webStream.CountQueuingStrategy;
|
|
29
|
+
global.ReadableByteStreamController = webStream.ReadableByteStreamController;
|
|
32
30
|
global.ReadableStream = webStream.ReadableStream;
|
|
31
|
+
global.ReadableStreamBYOBReader = webStream.ReadableStreamBYOBReader;
|
|
32
|
+
global.ReadableStreamBYOBRequest = webStream.ReadableStreamBYOBRequest;
|
|
33
|
+
global.ReadableStreamDefaultController = webStream.ReadableStreamDefaultController;
|
|
34
|
+
global.ReadableStreamDefaultReader = webStream.ReadableStreamDefaultReader;
|
|
35
|
+
global.TransformStream = webStream.TransformStream;
|
|
36
|
+
global.TransformStreamDefaultController = webStream.TransformStreamDefaultController;
|
|
33
37
|
global.WritableStream = webStream.WritableStream;
|
|
34
|
-
global.
|
|
38
|
+
global.WritableStreamDefaultController = webStream.WritableStreamDefaultController;
|
|
39
|
+
global.WritableStreamDefaultWriter = webStream.WritableStreamDefaultWriter;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
exports.installGlobals = installGlobals;
|
package/dist/implementations.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
export { AbortController } from "abort-controller";
|
|
2
|
-
export type { HeadersInit, RequestInfo, RequestInit, ResponseInit, } from "./fetch";
|
|
3
|
-
export { fetch, FormData, Headers, Request, Response } from "./fetch";
|
|
4
1
|
export { installGlobals } from "./globals";
|
|
5
2
|
export { createFileSessionStorage } from "./sessions/fileStorage";
|
|
6
3
|
export { createFileUploadHandler as unstable_createFileUploadHandler, NodeOnDiskFile, } from "./upload/fileUploadHandler";
|
|
7
4
|
export { createCookie, createCookieSessionStorage, createMemorySessionStorage, createSessionStorage, } from "./implementations";
|
|
8
5
|
export { createReadableStreamFromReadable, readableStreamToString, writeAsyncIterableToWritable, writeReadableStreamToWritable, } from "./stream";
|
|
9
|
-
export { createRequestHandler, createSession, defer, isCookie, isSession, json, MaxPartSizeExceededError, redirect, unstable_composeUploadHandlers, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData, } from "@remix-run/server-runtime";
|
|
10
|
-
export type {
|
|
6
|
+
export { createRequestHandler, createSession, defer, broadcastDevReady, logDevReady, isCookie, isSession, json, MaxPartSizeExceededError, redirect, redirectDocument, unstable_composeUploadHandlers, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData, } from "@remix-run/server-runtime";
|
|
7
|
+
export type { ActionFunction, ActionFunctionArgs, AppLoadContext, Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, DataFunctionArgs, EntryContext, ErrorResponse, HandleDataRequestFunction, HandleDocumentRequestFunction, HeadersArgs, HeadersFunction, HtmlLinkDescriptor, JsonFunction, LinkDescriptor, LinksFunction, LoaderFunction, LoaderFunctionArgs, MemoryUploadHandlerFilterArgs, MemoryUploadHandlerOptions, HandleErrorFunction, PageLinkDescriptor, RequestHandler, SerializeFrom, ServerBuild, ServerEntryModule, ServerRuntimeMetaArgs as MetaArgs, ServerRuntimeMetaDescriptor as MetaDescriptor, ServerRuntimeMetaFunction as MetaFunction, Session, SessionData, SessionIdStorageStrategy, SessionStorage, SignFunction, TypedDeferredData, TypedResponse, UnsignFunction, UploadHandler, UploadHandlerPart, } from "@remix-run/server-runtime";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/node v0.0.0-experimental-
|
|
2
|
+
* @remix-run/node v0.0.0-experimental-e48b44da5
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -12,30 +12,15 @@
|
|
|
12
12
|
|
|
13
13
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
14
|
|
|
15
|
-
var sourceMapSupport = require('source-map-support');
|
|
16
|
-
var abortController = require('abort-controller');
|
|
17
|
-
var fetch = require('./fetch.js');
|
|
18
15
|
var globals = require('./globals.js');
|
|
19
16
|
var fileStorage = require('./sessions/fileStorage.js');
|
|
20
17
|
var fileUploadHandler = require('./upload/fileUploadHandler.js');
|
|
21
18
|
var implementations = require('./implementations.js');
|
|
22
19
|
var stream = require('./stream.js');
|
|
23
20
|
var serverRuntime = require('@remix-run/server-runtime');
|
|
24
|
-
var webFetch = require('@remix-run/web-fetch');
|
|
25
21
|
|
|
26
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
27
22
|
|
|
28
|
-
var sourceMapSupport__default = /*#__PURE__*/_interopDefaultLegacy(sourceMapSupport);
|
|
29
23
|
|
|
30
|
-
sourceMapSupport__default["default"].install();
|
|
31
|
-
|
|
32
|
-
Object.defineProperty(exports, 'AbortController', {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () { return abortController.AbortController; }
|
|
35
|
-
});
|
|
36
|
-
exports.Request = fetch.Request;
|
|
37
|
-
exports.Response = fetch.Response;
|
|
38
|
-
exports.fetch = fetch.fetch;
|
|
39
24
|
exports.installGlobals = globals.installGlobals;
|
|
40
25
|
exports.createFileSessionStorage = fileStorage.createFileSessionStorage;
|
|
41
26
|
exports.NodeOnDiskFile = fileUploadHandler.NodeOnDiskFile;
|
|
@@ -52,6 +37,10 @@ Object.defineProperty(exports, 'MaxPartSizeExceededError', {
|
|
|
52
37
|
enumerable: true,
|
|
53
38
|
get: function () { return serverRuntime.MaxPartSizeExceededError; }
|
|
54
39
|
});
|
|
40
|
+
Object.defineProperty(exports, 'broadcastDevReady', {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () { return serverRuntime.broadcastDevReady; }
|
|
43
|
+
});
|
|
55
44
|
Object.defineProperty(exports, 'createRequestHandler', {
|
|
56
45
|
enumerable: true,
|
|
57
46
|
get: function () { return serverRuntime.createRequestHandler; }
|
|
@@ -76,10 +65,18 @@ Object.defineProperty(exports, 'json', {
|
|
|
76
65
|
enumerable: true,
|
|
77
66
|
get: function () { return serverRuntime.json; }
|
|
78
67
|
});
|
|
68
|
+
Object.defineProperty(exports, 'logDevReady', {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () { return serverRuntime.logDevReady; }
|
|
71
|
+
});
|
|
79
72
|
Object.defineProperty(exports, 'redirect', {
|
|
80
73
|
enumerable: true,
|
|
81
74
|
get: function () { return serverRuntime.redirect; }
|
|
82
75
|
});
|
|
76
|
+
Object.defineProperty(exports, 'redirectDocument', {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () { return serverRuntime.redirectDocument; }
|
|
79
|
+
});
|
|
83
80
|
Object.defineProperty(exports, 'unstable_composeUploadHandlers', {
|
|
84
81
|
enumerable: true,
|
|
85
82
|
get: function () { return serverRuntime.unstable_composeUploadHandlers; }
|
|
@@ -92,11 +89,3 @@ Object.defineProperty(exports, 'unstable_parseMultipartFormData', {
|
|
|
92
89
|
enumerable: true,
|
|
93
90
|
get: function () { return serverRuntime.unstable_parseMultipartFormData; }
|
|
94
91
|
});
|
|
95
|
-
Object.defineProperty(exports, 'FormData', {
|
|
96
|
-
enumerable: true,
|
|
97
|
-
get: function () { return webFetch.FormData; }
|
|
98
|
-
});
|
|
99
|
-
Object.defineProperty(exports, 'Headers', {
|
|
100
|
-
enumerable: true,
|
|
101
|
-
get: function () { return webFetch.Headers; }
|
|
102
|
-
});
|
|
@@ -19,4 +19,5 @@ interface FileSessionStorageOptions {
|
|
|
19
19
|
* @see https://remix.run/utils/sessions#createfilesessionstorage-node
|
|
20
20
|
*/
|
|
21
21
|
export declare function createFileSessionStorage<Data = SessionData, FlashData = Data>({ cookie, dir, }: FileSessionStorageOptions): SessionStorage<Data, FlashData>;
|
|
22
|
+
export declare function getFile(dir: string, id: string): string;
|
|
22
23
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/node v0.0.0-experimental-
|
|
2
|
+
* @remix-run/node v0.0.0-experimental-e48b44da5
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
14
|
|
|
15
|
-
var crypto = require('crypto');
|
|
16
|
-
var
|
|
17
|
-
var path = require('path');
|
|
15
|
+
var crypto = require('node:crypto');
|
|
16
|
+
var node_fs = require('node:fs');
|
|
17
|
+
var path = require('node:path');
|
|
18
18
|
var implementations = require('../implementations.js');
|
|
19
19
|
|
|
20
20
|
function _interopNamespace(e) {
|
|
@@ -58,9 +58,9 @@ function createFileSessionStorage({
|
|
|
58
58
|
expires
|
|
59
59
|
});
|
|
60
60
|
while (true) {
|
|
61
|
-
// TODO: Once
|
|
62
|
-
// API's crypto.getRandomValues() function here instead.
|
|
63
|
-
let randomBytes = crypto__namespace.
|
|
61
|
+
// TODO: Once Node v19 is supported we should use the globally provided
|
|
62
|
+
// Web Crypto API's crypto.getRandomValues() function here instead.
|
|
63
|
+
let randomBytes = crypto__namespace.webcrypto.getRandomValues(new Uint8Array(8));
|
|
64
64
|
// This storage manages an id space of 2^64 ids, which is far greater
|
|
65
65
|
// than the maximum number of files allowed on an NTFS or ext4 volume
|
|
66
66
|
// (2^32). However, the larger id space should help to avoid collisions
|
|
@@ -68,10 +68,10 @@ function createFileSessionStorage({
|
|
|
68
68
|
let id = Buffer.from(randomBytes).toString("hex");
|
|
69
69
|
try {
|
|
70
70
|
let file = getFile(dir, id);
|
|
71
|
-
await
|
|
71
|
+
await node_fs.promises.mkdir(path__namespace.dirname(file), {
|
|
72
72
|
recursive: true
|
|
73
73
|
});
|
|
74
|
-
await
|
|
74
|
+
await node_fs.promises.writeFile(file, content, {
|
|
75
75
|
encoding: "utf-8",
|
|
76
76
|
flag: "wx"
|
|
77
77
|
});
|
|
@@ -84,7 +84,7 @@ function createFileSessionStorage({
|
|
|
84
84
|
async readData(id) {
|
|
85
85
|
try {
|
|
86
86
|
let file = getFile(dir, id);
|
|
87
|
-
let content = JSON.parse(await
|
|
87
|
+
let content = JSON.parse(await node_fs.promises.readFile(file, "utf-8"));
|
|
88
88
|
let data = content.data;
|
|
89
89
|
let expires = typeof content.expires === "string" ? new Date(content.expires) : null;
|
|
90
90
|
if (!expires || expires > new Date()) {
|
|
@@ -92,7 +92,7 @@ function createFileSessionStorage({
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
// Remove expired session data.
|
|
95
|
-
if (expires) await
|
|
95
|
+
if (expires) await node_fs.promises.unlink(file);
|
|
96
96
|
return null;
|
|
97
97
|
} catch (error) {
|
|
98
98
|
if (error.code !== "ENOENT") throw error;
|
|
@@ -105,10 +105,10 @@ function createFileSessionStorage({
|
|
|
105
105
|
expires
|
|
106
106
|
});
|
|
107
107
|
let file = getFile(dir, id);
|
|
108
|
-
await
|
|
108
|
+
await node_fs.promises.mkdir(path__namespace.dirname(file), {
|
|
109
109
|
recursive: true
|
|
110
110
|
});
|
|
111
|
-
await
|
|
111
|
+
await node_fs.promises.writeFile(file, content, "utf-8");
|
|
112
112
|
},
|
|
113
113
|
async deleteData(id) {
|
|
114
114
|
// Return early if the id is empty, otherwise we'll end up trying to
|
|
@@ -117,7 +117,7 @@ function createFileSessionStorage({
|
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
try {
|
|
120
|
-
await
|
|
120
|
+
await node_fs.promises.unlink(getFile(dir, id));
|
|
121
121
|
} catch (error) {
|
|
122
122
|
if (error.code !== "ENOENT") throw error;
|
|
123
123
|
}
|
|
@@ -133,3 +133,4 @@ function getFile(dir, id) {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
exports.createFileSessionStorage = createFileSessionStorage;
|
|
136
|
+
exports.getFile = getFile;
|
package/dist/stream.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import type { Readable, Writable } from "stream";
|
|
3
|
+
import type { Readable, Writable } from "node:stream";
|
|
4
4
|
export declare function writeReadableStreamToWritable(stream: ReadableStream, writable: Writable): Promise<void>;
|
|
5
5
|
export declare function writeAsyncIterableToWritable(iterable: AsyncIterable<Uint8Array>, writable: Writable): Promise<void>;
|
|
6
6
|
export declare function readableStreamToString(stream: ReadableStream<Uint8Array>, encoding?: BufferEncoding): Promise<string>;
|
package/dist/stream.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @remix-run/node v0.0.0-experimental-
|
|
2
|
+
* @remix-run/node v0.0.0-experimental-e48b44da5
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -12,30 +12,26 @@
|
|
|
12
12
|
|
|
13
13
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var node_stream = require('node:stream');
|
|
16
16
|
|
|
17
17
|
async function writeReadableStreamToWritable(stream, writable) {
|
|
18
18
|
let reader = stream.getReader();
|
|
19
|
-
|
|
20
|
-
let {
|
|
21
|
-
done,
|
|
22
|
-
value
|
|
23
|
-
} = await reader.read();
|
|
24
|
-
if (done) {
|
|
25
|
-
writable.end();
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
writable.write(value);
|
|
29
|
-
|
|
30
|
-
// If the stream is flushable, flush it to allow streaming to continue.
|
|
31
|
-
let flushable = writable;
|
|
32
|
-
if (typeof flushable.flush === "function") {
|
|
33
|
-
flushable.flush();
|
|
34
|
-
}
|
|
35
|
-
await read();
|
|
36
|
-
}
|
|
19
|
+
let flushable = writable;
|
|
37
20
|
try {
|
|
38
|
-
|
|
21
|
+
while (true) {
|
|
22
|
+
let {
|
|
23
|
+
done,
|
|
24
|
+
value
|
|
25
|
+
} = await reader.read();
|
|
26
|
+
if (done) {
|
|
27
|
+
writable.end();
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
writable.write(value);
|
|
31
|
+
if (typeof flushable.flush === "function") {
|
|
32
|
+
flushable.flush();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
39
35
|
} catch (error) {
|
|
40
36
|
writable.destroy(error);
|
|
41
37
|
throw error;
|
|
@@ -55,19 +51,18 @@ async function writeAsyncIterableToWritable(iterable, writable) {
|
|
|
55
51
|
async function readableStreamToString(stream, encoding) {
|
|
56
52
|
let reader = stream.getReader();
|
|
57
53
|
let chunks = [];
|
|
58
|
-
|
|
54
|
+
while (true) {
|
|
59
55
|
let {
|
|
60
56
|
done,
|
|
61
57
|
value
|
|
62
58
|
} = await reader.read();
|
|
63
59
|
if (done) {
|
|
64
|
-
|
|
65
|
-
}
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
if (value) {
|
|
66
63
|
chunks.push(value);
|
|
67
64
|
}
|
|
68
|
-
await read();
|
|
69
65
|
}
|
|
70
|
-
await read();
|
|
71
66
|
return Buffer.concat(chunks).toString(encoding);
|
|
72
67
|
}
|
|
73
68
|
const createReadableStreamFromReadable = source => {
|
|
@@ -76,10 +71,10 @@ const createReadableStreamFromReadable = source => {
|
|
|
76
71
|
return stream;
|
|
77
72
|
};
|
|
78
73
|
class StreamPump {
|
|
79
|
-
constructor(stream
|
|
80
|
-
this.highWaterMark = stream
|
|
74
|
+
constructor(stream) {
|
|
75
|
+
this.highWaterMark = stream.readableHighWaterMark || new node_stream.Stream.Readable().readableHighWaterMark;
|
|
81
76
|
this.accumalatedSize = 0;
|
|
82
|
-
this.stream = stream
|
|
77
|
+
this.stream = stream;
|
|
83
78
|
this.enqueue = this.enqueue.bind(this);
|
|
84
79
|
this.error = this.error.bind(this);
|
|
85
80
|
this.close = this.close.bind(this);
|