I am trying to use this library in an AWS Lambda environment, so I don't have access to the file system. I'm generating a pptx file with PptxGenJs, then trying to add master slides from our corporate template that I'm reading in from s3. Is there a supported way to read a file from memory rather than a local directory?
i.e.
import pptxgen from "pptxgenjs"
import Automizer from "pptx-automizer"
import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3"
const pptx = new pptxgen()
//build presentation with pptxgen...
const s3Client = new S3Client()
const response = await s3Client.send(
new GetObjectCommand({ Bucket: templateBucket, Key: templateKey })
)
const template = await response.Body?.transformToByteArray()
const myPresentation = await pptx.write({
outputType: "nodebuffer"
})
const automizer = new Automizer()
const pres = automizer.loadRoot(template)
.load(template, "template")
.load(myPresentation, "myPres")
//...
I can see that .load and .loadRoot both only take a file path currently.
Is there another method that accepts a Buffer or Uint8Array?
If not, would you be open to accepting a PR that enables this behavior?
If so, would you prefer to overload the .load / .loadRoot methods so they could also accept binary?
I am trying to use this library in an AWS Lambda environment, so I don't have access to the file system. I'm generating a pptx file with PptxGenJs, then trying to add master slides from our corporate template that I'm reading in from s3. Is there a supported way to read a file from memory rather than a local directory?
i.e.
I can see that
.load
and.loadRoot
both only take a file path currently.Buffer
orUint8Array
?.load
/.loadRoot
methods so they could also accept binary?