Commit 62e1a68
stream: add toArray
Add the toArray method from the TC39 iterator helper proposal to
Readable streams. This also enables a common-use case of converting a
stream to an array.
Co-Authored-By: Robert Nagy <ronagy@icloud.com>
PR-URL: #41553
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>1 parent 6de8e51 commit 62e1a68Copy full SHA for 62e1a68
File tree
Expand file treeCollapse file tree
3 files changed
+136
-0
lines changedOpen diff view settings
Filter options
- doc/api
- lib/internal/streams
- test/parallel
Expand file treeCollapse file tree
3 files changed
+136
-0
lines changedOpen diff view settings
Collapse file
+40Lines changed: 40 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1835 | 1835 | |
1836 | 1836 | |
1837 | 1837 | |
| 1838 | + |
| 1839 | + |
| 1840 | + |
| 1841 | + |
| 1842 | + |
| 1843 | + |
| 1844 | + |
| 1845 | + |
| 1846 | + |
| 1847 | + |
| 1848 | + |
| 1849 | + |
| 1850 | + |
| 1851 | + |
| 1852 | + |
| 1853 | + |
| 1854 | + |
| 1855 | + |
| 1856 | + |
| 1857 | + |
| 1858 | + |
| 1859 | + |
| 1860 | + |
| 1861 | + |
| 1862 | + |
| 1863 | + |
| 1864 | + |
| 1865 | + |
| 1866 | + |
| 1867 | + |
| 1868 | + |
| 1869 | + |
| 1870 | + |
| 1871 | + |
| 1872 | + |
| 1873 | + |
| 1874 | + |
| 1875 | + |
| 1876 | + |
| 1877 | + |
1838 | 1878 | |
1839 | 1879 | |
1840 | 1880 | |
|
Collapse file
lib/internal/streams/operators.js
Copy file name to clipboardExpand all lines: lib/internal/streams/operators.js+17Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
2 | 2 | |
3 | 3 | |
| 4 | + |
| 5 | + |
4 | 6 | |
5 | 7 | |
6 | 8 | |
| ||
10 | 12 | |
11 | 13 | |
12 | 14 | |
| 15 | + |
13 | 16 | |
14 | 17 | |
15 | 18 | |
| ||
174 | 177 | |
175 | 178 | |
176 | 179 | |
| 180 | + |
| 181 | + |
| 182 | + |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | + |
| 188 | + |
| 189 | + |
| 190 | + |
| 191 | + |
| 192 | + |
177 | 193 | |
178 | 194 | |
179 | 195 | |
180 | 196 | |
181 | 197 | |
182 | 198 | |
183 | 199 | |
| 200 | + |
184 | 201 | |
Collapse file
test/parallel/test-stream-toArray.js
Copy file name to clipboard+79Lines changed: 79 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
0 commit comments