Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] RangeError [ERR_FS_FILE_TOO_LARGE] when buffer set false. #103

Open
3 tasks done
raoooool opened this issue Sep 1, 2023 · 0 comments
Open
3 tasks done

[bug] RangeError [ERR_FS_FILE_TOO_LARGE] when buffer set false. #103

raoooool opened this issue Sep 1, 2023 · 0 comments
Labels

Comments

@raoooool
Copy link

raoooool commented Sep 1, 2023

Describe the bug

Node.js version: v16.20.1

OS version: macOS 13.5.1

Description: the app crashes when attempting to read a file larger than 2GB.. setting config.buffer false.

Actual behavior

a file larger than 2GB located in the /public directory can cause the entire app to crash when attempting to read it.

Expected behavior

reading it normally.

Code to reproduce

const Koa = require("koa");
const path = require("path");
const staticCache = require("koa-static-cache");
const app = new Koa();

app.use(
  staticCache(path.join(__dirname, "public"), {
    buffer: false,
    dynamic: true,
    preload: false,
  })
);

app.use(async (ctx) => {
  ctx.body = "Hello World";
});

app.listen(3000);

Checklist

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.
  • I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.

Other

I suspect the issue may be related to the loadFile function:

image
@raoooool raoooool added the bug label Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant