Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about unpack() #284

Closed
sktbrt opened this issue Oct 11, 2023 · 1 comment
Closed

Question about unpack() #284

sktbrt opened this issue Oct 11, 2023 · 1 comment

Comments

@sktbrt
Copy link

sktbrt commented Oct 11, 2023

Hi, I want to call soffice.bin directly.
However, it seems that unpack() does not exist above v4 (?)

Or if you want more control:
```js
const {unpack, defaultArgs} = require('@shelf/aws-lambda-libreoffice');
await unpack(); // default path /tmp/instdir/program/soffice.bin
execSync(
`/tmp/instdir/program/soffice.bin ${defaultArgs.join(
' '
)} --convert-to pdf file.docx --outdir /tmp`
);
```

Is there a way to do the same?

@sktbrt
Copy link
Author

sktbrt commented Oct 12, 2023

Solved

https://github.com/shelfio/aws-lambda-brotli-unpacker

example:

const { execSync } = require('child_process');
const { unpack } = require('@shelf/aws-lambda-brotli-unpacker');

module.exports.handler = async event => {
   const inputPath = '/opt/lo.tar.br';
   const outputPath = '/tmp/instdir/program/soffice.bin';
   const command = `${outputPath} ....... --convert-to pdf .......`;
   await unpack({inputPath, outputPath});
   execSync(command);
};

NOTE:
If you use unpack(), the subsequent convertTo() will fail.
So I decided to run everything with execSync.

/bin/sh: 1: libreoffice7.4: not found

@sktbrt sktbrt closed this as completed Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant