Upload file without store file on the disk

i wanna create API to upload the file to openai without store the file on the disk, now i use nodejs+express for the api, then use multer as library, what i have done is:

  1. i have created the endpoint to receive the file
  2. use multer.memoryStorage() as storage
    then when i will handling the file which is i can acces on req.file the output is like this
{
  fieldname: 'file',
  originalname: 'test_LOTR.docx',
  encoding: '7bit',
  mimetype: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
  buffer: <Buffer 50 4b 03 04 14 00 06 00 08 00 00 00 21 00 df a4 d2 6c 5a 01 00 00 20 05 00 00 13 00 08 02 5b 43 6f 6e 74 65 6e 74 5f 54 79 70 65 73 5d 2e 78 6d 6c 20 ... 19482 more bytes>,
  size: 19532
}

the question is how to handle that? and i want to upload to openai using the sdk, but the sdk example is using file on disk not on memory

solved

const file = req.file;
    const newFile = new File([file.buffer], file.originalname, {
      type: file.mimetype,
    });

    const openai = new OpenAI({ apiKey: process.env.OPEN_AI_KEY });
    const upload = await openai.files.create({
      file: newFile,
      purpose: "assistants",
    });