Skip to content

Commit

Permalink
Merge pull request #280 from CesiumGS/reduce-max-buffer-length
Browse files Browse the repository at this point in the history
Don't merge buffers if final buffer exceeds fs.write maximum of `2147479552` bytes
  • Loading branch information
mramato authored Jan 25, 2023
2 parents 9b018ff + 6ab0dc1 commit 81f6d53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

### 3.1.5 - ????-??-??

- Fixed crash when writing GLB files above 2GB. [#280](https://github.com/CesiumGS/obj2gltf/pull/280)

### 3.1.4 - 2021-10-15

- Unlocked CesiumJS package now that CesiumJS 1.86.1 is released with a fix for Node 16. [#270](https://github.com/CesiumGS/obj2gltf/pull/270)
Expand Down
4 changes: 3 additions & 1 deletion lib/createGltf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"use strict";
const BUFFER_MAX_BYTE_LENGTH = require("buffer").constants.MAX_LENGTH;
const FS_WRITE_MAX_LENGTH = 2147479552; // See https://github.com/nodejs/node/issues/35605
const BUFFER_MAX_LENGTH = require("buffer").constants.MAX_LENGTH;
const BUFFER_MAX_BYTE_LENGTH = Math.min(FS_WRITE_MAX_LENGTH, BUFFER_MAX_LENGTH);
const Cesium = require("cesium");
const getBufferPadded = require("./getBufferPadded");
const getDefaultMaterial = require("./loadMtl").getDefaultMaterial;
Expand Down

0 comments on commit 81f6d53

Please sign in to comment.