@standardserver/node 0.0.7 → 0.0.9

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.
Files changed (2) hide show
  1. package/dist/index.mjs +4 -1
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { Buffer } from 'node:buffer';
1
2
  import { Readable } from 'node:stream';
2
3
  import { flattenStandardHeader, getFilenameFromContentDisposition, generateContentDisposition } from '@standardserver/core';
3
4
  import { parseEmptyableJSON, isAsyncIteratorObject, stringifyJSON, AbortError } from '@standardserver/shared';
@@ -104,10 +105,12 @@ function _streamToFormData(stream, contentType) {
104
105
  return response.formData();
105
106
  }
106
107
  async function _streamToString(stream) {
108
+ const decoder = new TextDecoder();
107
109
  let string = "";
108
110
  for await (const chunk of stream) {
109
- string += chunk.toString();
111
+ string += decoder.decode(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk), { stream: true });
110
112
  }
113
+ string += decoder.decode();
111
114
  return string;
112
115
  }
113
116
  async function _streamToFile(stream, fileName, contentType) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@standardserver/node",
3
3
  "type": "module",
4
- "version": "0.0.7",
4
+ "version": "0.0.9",
5
5
  "license": "MIT",
6
6
  "homepage": "https://standardserver.dev",
7
7
  "repository": {
@@ -20,9 +20,9 @@
20
20
  "dist"
21
21
  ],
22
22
  "dependencies": {
23
- "@standardserver/core": "0.0.7",
24
- "@standardserver/shared": "0.0.7",
25
- "@standardserver/fetch": "0.0.7"
23
+ "@standardserver/core": "0.0.9",
24
+ "@standardserver/fetch": "0.0.9",
25
+ "@standardserver/shared": "0.0.9"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^25.0.3",