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 input sources loading #4

Open
Salmondx opened this issue Jan 24, 2023 · 0 comments
Open

Question about input sources loading #4

Salmondx opened this issue Jan 24, 2023 · 0 comments

Comments

@Salmondx
Copy link

Salmondx commented Jan 24, 2023

I was trying to debug why my example stuck on processing and found this code in library sources:

/**
 * Retrieve the URL and type of a media source
 * @param {string|RawSource} source
 */
const getMetadata = async (page, id, source) => {
  let data
  let type
  if (typeof source === 'string') {
    // Source is a path. Read into a new buffer.
    data = fs.readFileSync(source, 'base64')
    const extension = source.substring(source.indexOf('.') + 1)
    type = mime.getType(extension)
  } else {
    // Source is an object of the form {type: string, data: Buffer}
    data = source.data.toString('base64')
    type = source.type
  }
  // Prepend base64 header
  url = `data:${type};base64,${data}`
  return { url, type }
}

As I can see files are just loaded as base64 strings to memory, correct? So it is not possible to use etro-node with large files or multiple input sources?

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant