# File upload from custom app

**URL:** <https://community.make.com/t/file-upload-from-custom-app/67174>\
**Category:** Questions\
**Created:** [January 22, 2025, 11:09pm UTC](https://community.make.com/t/file-upload-from-custom-app/67174 "2025-01-22T23:09:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lee\_Grainger](https://avatars.discourse-cdn.com/v4/letter/l/aeb1de/32.png) [@Lee\_Grainger](https://community.make.com/u/Lee_Grainger)\
**Post date:** [January 22, 2025, 11:09pm UTC](https://community.make.com/t/file-upload-from-custom-app/67174/1 "2025-01-22T23:09:38Z")

</div>

Hi,

I’m building an API that takes a JSON string from a Google Doc and returns an epub (ebook) file. I’m struggling with how to return the file in a way that [Make.com](http://Make.com) expects.

My custom module’s interface is configured like this:

```auto
[
    {
        "name": "name",
        "type": "filename",
        "label": "Name",
        "semantic": "file:name"
    },
    {
        "name": "data",
        "type": "buffer",
        "label": "Data",
        "semantic": "file:data"
    }

]

```

So I tried returning data like this:

```auto
      const fileBuffer = await fs.promises.readFile(epubFilePath);
      
      return res.status(200).json({
        name: fileName,
        data: fileBuffer, 
      });

```

The API response looked like this:

 ![Screenshot 2025-01-22 at 6.04.37 PM](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/9/5/9550fad220f260bc78da03fbaee694f374244797.png)

[Make.com](http://Make.com) didn’t recognize that as a buffer.

The I tried this:

```auto
// Read the file into a buffer
      const fileBuffer = await fs.promises.readFile(epubFilePath);

      // Calculate buffer metadata
      const size = fileBuffer.length; // Size of the buffer
      const checksum = this.calculateChecksum(fileBuffer); // Generate a checksum for the buffer
      const prefix = 'IMTBuffer';

      // Convert the buffer to a custom string format
      const hexData = fileBuffer
        .toString('hex')
        .match(/.{1,2}/g)
        ?.join('');
      const customFormattedData = `${prefix}(${size}, binary, ${checksum}): ${hexData}`;

      // Console log the first 100 characters of the custom formatted data
      console.log(customFormattedData.slice(0, 100));

      // Return the formatted data in JSON
      return res.status(200).json({
        name: fileName,
        data: customFormattedData, // Custom formatted buffer data
      });

```

Which returns the following:

 ![Screenshot 2025-01-22 at 6.06.42 PM](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/a/9/a9189b6012c2b63a1586316949d597976b0cf917.png)

[Make.com](http://Make.com) recognizes this as “Buffer, codepage:binary” but when I save the file to Google Drive, it saves the string version of the uploaded data instead of the binary version. If I inspect the file contents on Google Drive, it looks like this:

IMTBuffer(39004, binary, 8a231bb2dda2943224ca8050830c8af8254bcd09): 504b03040a0000000000a7a3365a6f61ab2c1400000014000000080000006d696d65747970656170706c69636174696f6e2f657075622b7a6970504b0304140008000800a7a3365a000000000000000000000000160000004d4554412d494e462f636f6e7461696e65722e786d6c…

Any thoughts? I have read all of the documentation and forum posts that I can find but I can’t figure it out.

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/make/original/1X/9786f7887a39f4a0fef4d09346ab5b54ce20222b.svg) [@system](https://community.make.com/u/system)\
**Post date:** [February 21, 2025, 11:09pm UTC](https://community.make.com/t/file-upload-from-custom-app/67174/2 "2025-02-21T23:09:47Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
