Commit e93f16d
fs: fix
82bdf8f fixed an issue by silently modifying the `start`
option for the case when only `end` is passed, in order to perform
reads from a specified range in the file.
However, that approach does not work for non-seekable files, since
a numeric `start` option means that positioned reads will be used
to read data from the file.
This patch fixes that, and instead ends reading after a specified
size by adjusting the read buffer size.
This way we avoid re-introducing the bug that 82bdf8f fixed,
and align behaviour with the native file stream mechanism
introduced in #18936 as well.
Backport-PR-URL: #19411
PR-URL: #19329
Fixes: #19240
Refs: #18121
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chen Gang <gangc.cxy@foxmail.com>createReadStream(…, {end: n}) for non-seekable fds1 parent 894b179 commit e93f16d
2 files changed
+43
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1919 | 1919 | | |
1920 | 1920 | | |
1921 | 1921 | | |
1922 | | - | |
1923 | | - | |
| 1922 | + | |
1924 | 1923 | | |
1925 | 1924 | | |
1926 | 1925 | | |
| |||
1943 | 1942 | | |
1944 | 1943 | | |
1945 | 1944 | | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
1946 | 1951 | | |
1947 | 1952 | | |
1948 | 1953 | | |
| |||
1996 | 2001 | | |
1997 | 2002 | | |
1998 | 2003 | | |
| 2004 | + | |
| 2005 | + | |
1999 | 2006 | | |
2000 | 2007 | | |
2001 | 2008 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
146 | 148 | | |
147 | 149 | | |
148 | 150 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | 151 | | |
155 | 152 | | |
156 | 153 | | |
| |||
173 | 170 | | |
174 | 171 | | |
175 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
176 | 205 | | |
177 | 206 | | |
178 | 207 | | |
| |||
0 commit comments