elwerene / libreoffice-convert

MIT License
241 stars 94 forks source link

"ENOENT: no such file or directory" Error with libreoffice-convert #113

Closed erseversahin closed 4 months ago

erseversahin commented 4 months ago

Environment:

Issue: I'm encountering an error while trying to convert a file to HTML format with embedded images using the libreoffice-convert library. The command I'm using is:


await convertAsync(buffer, "html:'HTML (StarWriter):EmbedImages'", undefined);

During this process, I receive the following error message:

File is being converted!
[Error: ENOENT: no such file or directory, open '/var/folders/xt/2f18b_1539j54k1kfgl7k0mr0000gn/T/libreofficeConvert_-5841-md32cYKTQoM0/source.html'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/var/folders/xt/2f18b_1539j54k1kfgl7k0mr0000gn/T/libreofficeConvert_-5841-md32cYKTQoM0/source.html'
}
elwerene commented 4 months ago

@erseversahin did you find a solution? This looks like you are using the wrong path.

erseversahin commented 4 months ago

@elwerene Unfortunately, I couldn't find the correct method. Can you guide me?

erseversahin commented 4 months ago

@erseversahin did you find a solution? This looks like you are using the wrong path.

When I use the following code, it works:

const file1 = await convertAsync(buffer, "html", undefined);

However, when I try to use it like this, I don't get any results:

const file1 = await convertAsync(buffer, "html:'HTML (StarWriter):EmbedImages'", undefined);

Can anyone guide me on why the second approach is not yielding any results?

@elwerene

elwerene commented 4 months ago

please try:


const file1 = await convertAsync(buffer, "\"html:'HTML (StarWriter):EmbedImages'\"", undefined);
erseversahin commented 4 months ago

please try:

const file1 = await convertAsync(buffer, "\"html:'HTML (StarWriter):EmbedImages'\"", undefined);
const file1 = await convertAsync(buffer, "\"html:'HTML (StarWriter):EmbedImages'\"", undefined);

ERROR [Error: ENOENT: no such file or directory, open '/var/folders/xt/2f18b_1539j54k1kfgl7k0mr0000gn/T/libreofficeConvert_-35186-QFhiq79RmK1L/source."html'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/var/folders/xt/2f18b_1539j54k1kfgl7k0mr0000gn/T/libreofficeConvert_-35186-QFhiq79RmK1L/source."html'
}

I tried again with your last correction suggestion, but I continue to encounter the same error. @elwerene