Comments (1)
While confusing and different from Node, this is working as intended. The docs do state this but need to be made clearer.
socket.write
returns the number of bytes written. That number may be less than the number of bytes passed.
Unlike Node, Bun does not buffer unsent bytes and leaves you to handle backpressure in the drain
callback. Think of write as saying "send as much of this as you can right now" and it replies with "here's how much I sent". This does not mean it will make any attempt to send the rest of the data itself.
To make this easier, you can use ArrayBufferSink to handle buffering text or binary data and write that to it.
You can also use node:net if you prefer the buffering behavior of Node
from bun.
Related Issues (20)
- [windows]: `EPERM` when installing the package locally at `../my-package`
- Configurable `node_modules` folder name. HOT 5
- Bun crashed while creating a vite app
- Segmentation fault at address 0x21535245298 oh no: Bun has crashed. HOT 1
- Bun install --production fails in docker container HOT 1
- bun install crashes in github.com/clerk/javascript
- `process.hrtime` is the wrong time HOT 1
- `bun update` only partially updates the lockfile
- Bun 1.1.24 can't run expo project
- `bunx --bun astro dev` does not reload configuration
- TLS handshake timeout
- [BUN API] Unable to use fetch with UNIX Socket
- Building a dependency causes `Attempted to assign to a readonly property` HOT 2
- Built-in Tasks Scheduler supports cron expressions
- add possiblity to export dependencies to package-lock.json
- Improve DX of patching when updating packages HOT 1
- Segmentation fault? from WASM? HOT 1
- Silent crash when streaming from stdin
- Crash during a long running script
- --- Bun is auto-restarting due to crash [time: 1724066411841] --- HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bun.