# Upload file : Cannot create a string longer than 0x1fffffe8 characters

**URL:** <https://community.parseplatform.org/t/upload-file-cannot-create-a-string-longer-than-0x1fffffe8-characters/3049>\
**Category:** REST API\
**Tags:** files\
**Created:** [November 10, 2022, 11:07am UTC](https://community.parseplatform.org/t/upload-file-cannot-create-a-string-longer-than-0x1fffffe8-characters/3049 "2022-11-10T11:07:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FELS-Zak](https://community.parseplatform.org/user_avatar/community.parseplatform.org/fels-zak/32/423_2.png) [@FELS-Zak](https://community.parseplatform.org/u/FELS-Zak)\
**Post date:** [November 10, 2022, 11:07am UTC](https://community.parseplatform.org/t/upload-file-cannot-create-a-string-longer-than-0x1fffffe8-characters/3049/1 "2022-11-10T11:07:07Z")

</div>

Hi  
We’ trying to upload a 430 Meg file and get the error : \> Cannot create a string longer than 0x1fffffe8 characters.

Looks to be in the core- Any idea on how to solve or work around this ?

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [November 10, 2022, 7:31pm UTC](https://community.parseplatform.org/t/upload-file-cannot-create-a-string-longer-than-0x1fffffe8-characters/3049/2 "2022-11-10T19:31:23Z")

</div>

Would you mind to share the code that you are using to upload the file?

---

<div class="post-metadata">

**Author:** ![aadistudios](https://community.parseplatform.org/user_avatar/community.parseplatform.org/aadistudios/32/1668_2.png) [@aadistudios](https://community.parseplatform.org/u/aadistudios)\
**Post date:** [October 4, 2023, 9:31am UTC](https://community.parseplatform.org/t/upload-file-cannot-create-a-string-longer-than-0x1fffffe8-characters/3049/3 "2023-10-04T09:31:30Z")

</div>

I experienced this error while fetching a file. To optimize the efficiency of the proxy server, I implemented buffer-based data streaming with chunking in my code using Node.js. Here’s an example of how you can do it:

When the error occurred, I used to send response data like this:  
// Send the response data  
`res.status(response.status).send(response.data);`

I also set the response type as Blob:  
const response = await axios.get(url, { responseType: ‘blob’ });

After making the correction, I send the response like this:  
// Send the response as a stream  
`response.data.pipe(res);`

And I set the response type as Stream:  
`const response = await axios.get(url, { responseType: 'stream' });`

This approach should help improve the speed and memory usage when transferring large files or streams of data.

server.js

```auto
const axios = require('axios');
const express = require('express');
const app = express();

app.get('/proxy', async (req, res) => {
  const name = req.query.topic;
  const url = req.query.url;

  try {
    const response = await axios.get(url, { responseType: 'stream' });

    // Set the Content-Type header to 'video/mp4'
    res.setHeader('Content-Type', 'video/mp4');

    // Set the Content-Disposition header to suggest a filename
    res.setHeader('Content-Disposition', `inline; filename="${name}.mp4"`);

    // Forward the response headers from the remote server
    for (const [key, value] of Object.entries(response.headers)) {
      res.setHeader(key, value);
    }

    // Stream the response data in chunks
    response.data.pipe(res);
  } catch (error) {
    console.error('Proxy error:', error.message);
    res.status(500).send('Proxy error');
  }
});

const port = process.env.PORT || 3000;
app.listen(port, () => {
  console.log(`Server is running on port ${port}`);
});

```
