Skip to content

Commit

Permalink
feat: add arrayBufer
Browse files Browse the repository at this point in the history
Signed-off-by: Jeroen Branje <[email protected]>
  • Loading branch information
jeroenbranje committed Nov 27, 2024
1 parent ce10c1a commit e78ff0e
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const createFilename = _createFilename({
})

export const getFileFromByteArray = async (byteArray: Uint8Array, filename: string) =>
extractFromByteArray(byteArray, filename).then(read)
extractFromByteArray(byteArray, filename) //.then(read)

export const getDomainMetadataPath = (manifest: Manifest) =>
pipe(
Expand Down Expand Up @@ -102,14 +102,15 @@ export const getAllManifestLinksAndFormatPaths = (manifest: Manifest) =>
)(manifest)

export const _getPathAndBufferFromFile =
({ getFileFromByteArray }: { getFileFromByteArray: (byteArray: Uint8Array, filename: string) => Promise<string> }) =>
({ getFileFromByteArray }: { getFileFromByteArray: (byteArray: Uint8Array, filename: string) => Promise<Blob> }) =>
async (byteArray: Uint8Array, path: string, type: string) => {
const fileString = await getFileFromByteArray(byteArray, path)
const arrayBuffer = await fileString.arrayBuffer()

return {
path,
type,
buffer: Buffer.from(fileString),
buffer: Buffer.from(arrayBuffer),
}
}

Expand Down

0 comments on commit e78ff0e

Please sign in to comment.