@poe-platform/safe-fs 0.1.790 → 0.1.792

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.
@@ -0,0 +1 @@
1
+ export declare function concatBytes(chunks: readonly Uint8Array[], length: number): Uint8Array;
@@ -0,0 +1,9 @@
1
+ export function concatBytes(chunks, length) {
2
+ const result = new Uint8Array(length);
3
+ let offset = 0;
4
+ for (const chunk of chunks) {
5
+ result.set(chunk, offset);
6
+ offset += chunk.length;
7
+ }
8
+ return result;
9
+ }
@@ -1,3 +1,4 @@
1
+ import { concatBytes } from "./bytes.js";
1
2
  import { once } from "node:events";
2
3
  import { request as httpRequest } from "node:http";
3
4
  import { request as httpsRequest } from "node:https";
@@ -188,7 +189,7 @@ export async function collect(response, maximum, expected) {
188
189
  chunks.push(chunk);
189
190
  count += chunk.length;
190
191
  }
191
- return Buffer.concat(chunks, count);
192
+ return concatBytes(chunks, count);
192
193
  }
193
194
  finally {
194
195
  response.close();
@@ -1,3 +1,4 @@
1
+ import { concatBytes } from "./bytes.js";
1
2
  import { isIP } from "node:net";
2
3
  import { S3ServiceError } from "../transport.js";
3
4
  import { abortable, collect, limitedBody, scopeFor, sendRequest } from "./request.js";
@@ -322,7 +323,7 @@ export function createS3HttpTransport(options) {
322
323
  scope.signal.throwIfAborted();
323
324
  const metadata = directive === "REPLACE" ? replacementMetadata : output.Metadata;
324
325
  const headers = { ...metadataHeaders(metadata), ...destinationCondition };
325
- const response = await exchange("PUT", destination.Bucket, destination.Key, headers, [], Buffer.concat(chunks, count), operationOptions);
326
+ const response = await exchange("PUT", destination.Bucket, destination.Key, headers, [], concatBytes(chunks, count), operationOptions);
326
327
  try {
327
328
  if (response.message.statusCode !== 200)
328
329
  malformed("unexpected COPY fallback PUT status");
@@ -364,7 +365,7 @@ export function createS3HttpTransport(options) {
364
365
  chunks.push(chunk);
365
366
  count += chunk.length;
366
367
  }
367
- return { ...response, Body: Buffer.concat(chunks, count) };
368
+ return { ...response, Body: concatBytes(chunks, count) };
368
369
  },
369
370
  getObjectStream: get,
370
371
  async putObject(input, requestOptions) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-fs",
3
- "version": "0.1.790",
3
+ "version": "0.1.792",
4
4
  "description": "Composable filesystem with a portable core and explicit Node adapters",
5
5
  "type": "module",
6
6
  "license": "MIT",