MCPcopy Create free account
hub / github.com/nodejs/node / randomChunk

Function randomChunk

test/fixtures/wpt/streams/resources/rs-utils.js:103–112  ·  view source on GitHub ↗
(size)

Source from the content-addressed store, hash-verified

101 }
102
103 function randomChunk(size) {
104 let chunk = '';
105
106 for (let i = 0; i < size; ++i) {
107 // Add a random character from the basic printable ASCII set.
108 chunk += String.fromCharCode(Math.round(Math.random() * 84) + 32);
109 }
110
111 return chunk;
112 }
113
114 function readableStreamToArray(readable, reader) {
115 if (reader === undefined) {

Callers 1

writeChunkMethod · 0.85

Calls 1

randomMethod · 0.80

Tested by

no test coverage detected