@aws-amplify/storage
Version:
Storage category of aws-amplify
1 lines • 1.56 kB
Source Map (JSON)
{"version":3,"file":"readFile.mjs","sources":["../../../../../src/providers/s3/utils/readFile.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport const readFile = (file) => {\n // Browser path: use FileReader when available.\n if (typeof FileReader !== 'undefined') {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result);\n };\n reader.onabort = () => {\n reject(new Error('Read aborted'));\n };\n reader.onerror = () => {\n reject(reader.error);\n };\n reader.readAsArrayBuffer(file);\n });\n }\n // Server (Node.js 18+) path: Blob/File both expose arrayBuffer().\n return file.arrayBuffer();\n};\n"],"names":[],"mappings":"AAAA;AACA;AACY,MAAC,QAAQ,GAAG,CAAC,IAAI,KAAK;AAClC;AACA,IAAI,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE;AAC3C,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAChD,YAAY,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE;AAC3C,YAAY,MAAM,CAAC,MAAM,GAAG,MAAM;AAClC,gBAAgB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;AACtC,YAAY,CAAC;AACb,YAAY,MAAM,CAAC,OAAO,GAAG,MAAM;AACnC,gBAAgB,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;AACjD,YAAY,CAAC;AACb,YAAY,MAAM,CAAC,OAAO,GAAG,MAAM;AACnC,gBAAgB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;AACpC,YAAY,CAAC;AACb,YAAY,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC;AAC1C,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ;AACA,IAAI,OAAO,IAAI,CAAC,WAAW,EAAE;AAC7B;;;;"}