UNPKG

@aws-amplify/storage

Version:

Storage category of aws-amplify

39 lines (37 loc) 1.79 kB
'use strict'; // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 Object.defineProperty(exports, "__esModule", { value: true }); exports.uploadData = uploadData; const core_1 = require("@aws-amplify/core"); const readFile_1 = require("../../client/utils/readFile"); const toBase64_1 = require("../../client/utils/toBase64"); const uploadData_1 = require("../../providers/s3/apis/internal/uploadData"); function uploadData(ctxOrInput, maybeInput) { // Resolve the optional leading context. The global context is resolved at // CALL time (never cached) so single-arg callers follow live configuration. const [ctx, input] = (0, core_1.isAmplifyContext)(ctxOrInput) ? [ctxOrInput, maybeInput] : [(0, core_1.getGlobalContext)(), ctxOrInput]; const { data, path, options } = input; return (0, uploadData_1.uploadData)({ amplify: ctx, readFile: readFile_1.readFile, toBase64: toBase64_1.toBase64 }, { path, data, options: { useAccelerateEndpoint: options?.useAccelerateEndpoint, bucket: options?.bucket, onProgress: options?.onProgress, contentDisposition: options?.contentDisposition, contentEncoding: options?.contentEncoding, contentType: options?.contentType, metadata: options?.metadata, preventOverwrite: options?.preventOverwrite, expectedBucketOwner: options?.expectedBucketOwner, checksumAlgorithm: options?.checksumAlgorithm, // Advanced options locationCredentialsProvider: options?.locationCredentialsProvider, customEndpoint: options?.customEndpoint, }, }); } //# sourceMappingURL=uploadData.js.map