Node.js 26.5.0 זמינה כעת. זוהי גרסת Current, ולא ענף LTS, ולכן היא נמצאת בחזית הטכנולוגיה של הפלטפורמה. ההבחנה הזו חשובה. לא כדאי להחליף אותה באופן עיוור בסביבת ייצור (production fleet) שמצפה לשמונה עשרה חודשי יציבות. אך גרסאות מהירות וקטנות כאלו הן המקום שבו ניתן לראות את העתיד מתגבש. הן מראות אילו APIs המפתחים משפרים ולאן סביבת ההרצה (runtime) מכוונת הלאה. בגרסה 26.5.0, העבודה המרכזית מתמקדת ב-Web Streams API, עם זוג תיקונים ממוקדים שמקרבים את Node לשוויון יכולות מול הדפדפן. הגרסה גם מנקה שתי בעיות קטנות בשכבות הטיפול במערכת הקבצים (file system) וב-URL.
מה עושים Web Streams ב-Node.js?
אם כתבת קוד streaming ב-Node לאורך זמן, אתה בטח יודע שלמודול ה-stream המובנה יש אישיות משלו. Readable, Writable, Transform, ו-Duplex היו סוסי העבודה של האקוסיסטם במשך שנים. הם חזקים, אך הם אינם זהים ל-streams שאתה פוגש בדפדפן. כשאתה מנסה לחלוק לוגיקה בין service worker בצד הלקוח (front-end) לבין route handler בצד השרת (back-end), הפער הזה הופך לחיכוך. אתה מוצא את עצמך כותב מחדש מתאמים (adapters), מעתיק נתונים למבנים לא מוכרים, או פשוט נמנע לחלוטין משיתוף קוד.
ה-Web Streams API קיים כדי לסגור את הפער הזה. זהו אותו תקן שמניע את הטיפול ב-body של fetch בדפדפן. על ידי הבאתו ל-Node, הפרויקט מאפשר לך לכתוב לוגיקת streaming פעם אחת ולהריץ אותה בכל אחת מהסביבות. ה-API עובד עם אובייקטים מסוג ReadableStream, WritableStream, ו-TransformStream שמעבירים chunks דרך ממשק אחיד. גרסה 26.5.0 אינה כותבת מחדש את הממשק הזה, אך היא מהדקת שני ברגים חשובים.
תיקון releaseLock וניקוי של BYOB Readers
שינוי קונקרטי אחד בגרסה זו הוא תיקון עבור המתודה releaseLock ב-WritableStreamDefaultWriter. במודל ה-Web Streams, נעילת כותב (writer lock) מונעת מצורכנים מרובים לגשת לאותו stream בו-זמנית. כשאתה קורא ל-releaseLock(), אתה מאותת שהכותב שלך סיים ושה-stream שבבסיסו פנוי לפעולה הבאה. מימוש שגוי כאן עלול להשאיר stream במצב של המתנה (limbo), כשהוא עדיין מאמין שהוא תפוס למרות שהכותב נעלם. בשרת עמוס שמנתח (parsing) העלאות או מעביר (piping) נתונים לאחסון, סוג כזה של נעילה ישנה עלול לעכב pipeline או להקפיץ שגיאות שקשה לעקוב אחריהן עד למקורן. התיקון ב-26.5.0 הופך את העברת השליטה לצפויה מחדש.
השינוי השני ב-Web Streams משפר את האופן שבו ReadableStream ו-TransformStream עובדים עם BYOB readers. BYOB מייצג Bring Your Own Buffer. במקום שה-stream יקצה חלק זיכרון (chunk) חדש בכל פעם שהוא מספק נתונים, אתה מעביר לו באפר שכבר שמרת בצד. ה-stream ממלא את הבאפר הזה, אתה מעבד את הבייטים, ואז אתה מחזיר את אותו הבאפר לשימוש חוזר. זהו הבדל מכני קטן שמניב תוצאות משמעותיות מאוד כשאתה מעביר נפחי נתונים גדולים.
ל-Node יש תמיכה ב-BYOB כבר זמן מה, אך מקרי קצה ב-ReadableStream ו-TransformStream היו עלולים להתנהג בצורה לא תקינה כאשר צורב BYOB היה מחובר. הפרטים הטכניים של התיקון חשובים פחות מהתוצאה המעשית: streams המשתמשים בבאפרים מפורשים הם כעת אמינים יותר הן בשלבי הקריאה והן בשלבי הטרנספורמציה. אם נמנעת משימוש ב-BYOB readers בגלל שגיאות מוזרות בזמן אירועי backpressure, גרסה זו מסירה סיבה נוספת להתרחק מהם.
איפה BYOB באמת בא לידי ביטוי
קל לדבר על שימוש חוזר בבאפרים (buffer reuse) בצורה מופשטת. הרבה יותר מועיל לחשוב איפה זה באמת משנה.
דמיין שאתה כותב שירות שמקבל העלאות טלמטריה. ההעלאות הללו עשויות להיות לוגים דחוסים או דאמפים גולמיים מחיישנים, כשכל אחד מהם שוקל כמה מאות מגה-בייט. אם ה-stream מקצה Buffer חדש של Node עבור כל חלק של נתונים, ה-garbage collector יעבוד שעות נוספות וקפיצות הזיכרון יעלו במהירות. עם BYOB reader, אתה מקצה מאגר (pool) צנוע של באפרים בתחילת הריצה. ה-stream ממלא אותם, ה-parser שלך מרוקן אותם, והם חוזרים למעגל. הזיכרון נשאר יציב. אותו דפוס תקף גם כשאתה מבצע proxy לתעבורת רשת בין שני sockets או מנתח קבצי CSV גדולים שורה אחר שורה מבלי לטעון את כולו ל-RAM.
Transform streams are equally important here. A TransformStream sits in the middle of a pipeline, perhaps decompressing a gzip stream or encrypting chunks on the fly. If the transform step mishandles BYOB buffers, you can see corrupted output, dropped chunks, or stalls under load. The 26.5.0 fixes address exactly those kinds of pipeline hiccups, which is why anyone running high-throughput I/O should pay attention.
The Quiet Wins: File System and Error Clarity
Not everything in 26.5.0 is about streaming. The release also fixes behavior in fs.rm and fs.rmSync when the recursive option is set to false. Previously, passing recursive: false alongside a directory path could produce unexpected results during cleanup. The method might act in ways that did not match the explicit intent of the caller, deleting more than expected or failing in inconsistent ways depending on the platform. Cleaning up files is the sort of operation that should be boring and predictable. Boring is good. This fix restores that predictability, so your temporary directory cleanup scripts or deployment teardown logic behave exactly as the code suggests.
There is also a quality-of-life improvement in how URL.canParse reports failure. The method checks whether a string is a valid URL without throwing on malformed input. In 26.5.0, it now carries better Error.cause information when something goes wrong. Rather than swallowing the original reason, the error object preserves a causal chain. That means when a URL parse fails deep inside a validation helper, the stack you log tells you whether the issue was a bad protocol, a missing hostname, or some other structural problem. You spend less time sprinkling manual debug logs across every call site.
Should You Upgrade?
The answer depends on what you are running.
If your production workloads sit on an LTS version such as the v20.x line, stay there. These fixes will eventually backport or arrive in the next active LTS. Stability and predictable support timelines outweigh the benefit of a slightly smoother stream lock or clearer URL error on a server that is already working.
If you are building a new service, prototyping a real-time data pipeline, or actively using the Web Streams API for performance-critical I/O, 26.5.0 is worth the jump. The incremental alignment between Node streams and browser Web Streams is not just a compatibility win. It is a bet on a more unified JavaScript runtime where the same data-pushing logic can travel between server and client without translation layers. That cuts down on cognitive load and reduces the surface area for bugs when your team ships code to both environments.
This release is small, but the direction is clear. Node is continuing to invest in standards-based APIs that work everywhere JavaScript runs. The Web Streams improvements are not headline features, but they smooth out a path that has been rocky for years. Grab 26.5.0 if you live on the Current line, and watch for these fixes to land in your LTS world when the time is right.
Source: Dev.to – Node.js 26.5.0: What's New for Web Streams and Error Handling
Join the discussion and keep learning with the GyaanSetu community on Telegram.
