1const axios = require('axios')
2
3function serializeBytes(sty) {
4 const string = JSON.stringify({ data: sty })
5 const input = Array.from(string)
6 const ouput = input.map((_, i) => string.charCodeAt(i))
7 return new Uint8Array(ouput)
8}
9
10function deserializeBytes(array) {
11 return new TextDecoder().decode(array)
12}
13
14// render 25.000 data no maximum call stack
15async function httpRequest() {
16 const resOne = await axios.get('https://jsonplaceholder.typicode.com/photos')
17 const resTwo = await axios.get('https://jsonplaceholder.typicode.com/photos')
18 const resThree = await axios.get('https://jsonplaceholder.typicode.com/photos')
19 const resFour = await axios.get('https://jsonplaceholder.typicode.com/photos')
20 const resFive = await axios.get('https://jsonplaceholder.typicode.com/photos')
21 const data = await Promise.all([resOne.data, resTwo.data, resThree.data, resFour.data, resFive.data])
22
23 const encoded = serializeBytes(JSON.stringify({ data: data }))
24 const decoded = deserializeBytes(encoded)
25 const parse = JSON.parse(decoded)
26 console.log(parse)
27}
28
29httpRequest()